Cody

Problem 81. Mandelbrot Numbers

Solution 2991598

Submitted on 25 Sep 2020 by Chris Winnard
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))

rows = 1 cols = 1 cStart = 0 iter = 1 C = 0 iter = 2 N = 2 C = 0 iter = 3 N = 3 C = 0 iter = 4 N = 4 C = 0 iter = 5 N = 5 N = 5

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

rows = 2 cols = 2 cStart = 0 iter = 1 C = 0 0.5000 1.0000 4.0000 iter = 2 N = 2 1 1 1 C = 0 0.5000 1.0000 4.0000 iter = 3 N = 3 1 1 1 C = 0 0.5000 1.0000 4.0000 iter = 4 N = 4 1 1 1 C = 0 0.5000 1.0000 4.0000 iter = 5 N = 5 1 1 1 cStart = 0.5000 iter = 1 C = 0 0.7500 1.0000 4.0000 iter = 2 N = 5 2 1 1 C = 0 1.0625 1.0000 4.0000 iter = 3 N = 5 3 1 1 C = 0 1.6289 1.0000 4.0000 iter = 4 N = 5 4 1 1 C = 0 3.1533 1.0000 4.0000 iter = 4 N = 5 4 1 1 N = 5 4 1 1 cStart = 1 iter = 1 C = 0 3.1533 2.0000 4.0000 iter = 2 N = 5 4 2 1 C = 0 3.1533 5.0000 4.0000 iter = 2 N = 5 4 2 1 cStart = 4 iter = 1 N = 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))

rows = 1 cols = 4 cStart = 0.0000 + 1.0000i iter = 1 C = -1.0000 + 1.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 2 N = 2 1 1 1 C = 0.0000 - 1.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 3 N = 3 1 1 1 C = -1.0000 + 1.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 4 N = 4 1 1 1 C = 0.0000 - 1.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 5 N = 5 1 1 1 C = -1.0000 + 1.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 6 N = 6 1 1 1 C = 0.0000 - 1.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 7 N = 7 1 1 1 C = -1.0000 + 1.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 8 N = 8 1 1 1 C = 0.0000 - 1.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 9 N = 9 1 1 1 C = -1.0000 + 1.0000i 1.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 10 N = 10 1 1 1 cStart = 1 iter = 1 C = -1.0000 + 1.0000i 2.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 2 N = 10 2 1 1 C = -1.0000 + 1.0000i 5.0000 + 0.0000i 0.0000 - 2.0000i -2.0000 + 0.0000i iter = 2 N = 10 2 1 1 cStart = 0.0000 - 2.0000i iter = 1 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i -2.0000 + 0.0000i iter = 1 N = 10 2 1 1 cStart = -2 iter = 1 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i 2.0000 + 0.0000i iter = 2 N = 10 2 1 2 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i 2.0000 + 0.0000i iter = 3 N = 10 2 1 3 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i 2.0000 + 0.0000i iter = 4 N = 10 2 1 4 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i 2.0000 + 0.0000i iter = 5 N = 10 2 1 5 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i 2.0000 + 0.0000i iter = 6 N = 10 2 1 6 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i 2.0000 + 0.0000i iter = 7 N = 10 2 1 7 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i 2.0000 + 0.0000i iter = 8 N = 10 2 1 8 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i 2.0000 + 0.0000i iter = 9 N = 10 2 1 9 C = -1.0000 + 1.0000i 5.0000 + 0.0000i -4.0000 - 2.0000i 2.0000 + 0.0000i iter = 10 N = 10 2 1 10 N = 10 2 1 10

Suggested Problems

More from this Author95

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!