Cody

Problem 81. Mandelbrot Numbers

Solution 2068699

Submitted on 24 Dec 2019 by Asif Newaz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
C = 0; lim = 5; N_correct = 5; assert(isequal(mandelbrot(C,lim),N_correct))

z = 0 z = 0 0 z = 0 0 0 z = 0 0 0 0 z = 0 0 0 0 0 z = 0 0 0 0 0 0 y = 5

2   Pass
C = [0 0.5; 1 4]; lim = 5; N_correct = [5 4; 2 1]; assert(isequal(mandelbrot(C,lim),N_correct))

z = 0 z = 0 0 z = 0 0 0 z = 0 0 0 0 z = 0 0 0 0 0 z = 0 0 0 0 0 0 y = 5.0000 0.5000 1.0000 4.0000 z = 1 0 0 0 0 0 z = 1 2 0 0 0 0 z = 1 2 5 0 0 0 y = 5.0000 0.5000 2.0000 4.0000 z = 0.5000 2.0000 5.0000 0 0 0 z = 0.5000 0.7500 5.0000 0 0 0 z = 0.5000 0.7500 1.0625 0 0 0 z = 0.5000 0.7500 1.0625 1.6289 0 0 z = 0.5000 0.7500 1.0625 1.6289 3.1533 0 y = 5 4 2 4 z = 4.0000 0.7500 1.0625 1.6289 3.1533 0 z = 4.0000 20.0000 1.0625 1.6289 3.1533 0 y = 5 4 2 1

3   Pass
i = sqrt(-1); C = [i 1 -2*i -2]; lim = 10; N_correct = [10 2 1 10]; assert(isequal(mandelbrot(C,lim),N_correct))

z = 0.0000 + 1.0000i z = 0.0000 + 1.0000i -1.0000 + 1.0000i z = 0.0000 + 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i z = 0.0000 + 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i z = 0.0000 + 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i z = 0.0000 + 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i z = 0.0000 + 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i z = 0.0000 + 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i z = 0.0000 + 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 0.0000 + 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Column 10 -1.0000 + 1.0000i z = Columns 1 through 9 0.0000 + 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i y = 10.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i z = Columns 1 through 9 1.0000 + 0.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 1.0000 + 0.0000i 2.0000 + 0.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 1.0000 + 0.0000i 2.0000 + 0.0000i 5.0000 + 0.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i y = 10.0000 + 0.0000i 2.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i z = Columns 1 through 9 0.0000 - 2.0000i 2.0000 + 0.0000i 5.0000 + 0.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 0.0000 - 2.0000i -4.0000 - 2.0000i 5.0000 + 0.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i y = 10 2 1 -2 z = Columns 1 through 9 -2.0000 + 0.0000i -4.0000 - 2.0000i 5.0000 + 0.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 -2.0000 + 0.0000i 2.0000 + 0.0000i 5.0000 + 0.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 -2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 -2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 -2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 -2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 0.0000 - 1.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 -2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i -1.0000 + 1.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 -2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 0.0000 - 1.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 -2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i Columns 10 through 11 -1.0000 + 1.0000i 0.0000 - 1.0000i z = Columns 1 through 9 -2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i 2.0000 + 0.0000i Columns 10 through 11 2.0000 + 0.0000i 0.0000 - 1.0000i z = -2 2 2 2 2 2 2 2 2 2 2 y = 10 2 1 10