Cody

# Problem 81. Mandelbrot Numbers

Solution 1871065

Submitted on 11 Jul 2019
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 N = 1 z = 0 N = 2 z = 0 N = 3 z = 0 N = 4 z = 0 N = 5

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

z = 0 0.5000 1.0000 4.0000 N = 1 z = 0.5000 2.5000 5.0000 20.5000 N = 2 z = 12.7500 53.0000 106.0000 436.7500 N = 3

Assertion failed.

3   Fail
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 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i N = 1

Error using ^ (line 51) Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'. Error in mandelbrot (line 8) z=z^2+C Error in Test3 (line 5) assert(isequal(mandelbrot(C,lim),N_correct))