Cody

# Problem 785. Mandelbrot Number Test [Real+Imaginary]

Solution 1806210

Submitted on 5 May 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
format long v=[-2; 0.22-0.54i ; 0.25-.54i ; 0.26 ;.125+.125i; 0.25]; tf=isMandelbrot(v); tf_expected=[1 ; 0 ; 1 ; 0 ; 1 ; 1] ; assert(isequal(tf,tf_expected),sprintf('\n%f %f %f %f %f %f',tf,tf_expected))

tf = 6×1 logical array 1 0 1 0 1 1

2   Fail
v=-.25*ones(6,1)+(rand(6,1)-.5)/2+i*(rand(6,1)-.5)/2 %v=[-.5-.25i;-.5+.25i;-.25i;.25i;-.25-.25i;-.25+.25i] % Bounding Cases tf=isMandelbrot(v); tf_expected=[1 ; 1 ; 1 ; 1 ; 1 ; 1] ; assert(isequal(tf,tf_expected),sprintf('\n%f %f %f %f %f %f',tf,tf_expected))

v = -0.132701966001337 + 0.198265976446608i -0.275098605896979 - 0.094231622694760i -0.266431930156830 - 0.112868455248679i -0.290550733798327 - 0.076055757519830i -0.266272000901922 + 0.059154074319800i -0.228013925271744 - 0.043846039645695i tf = 6×1 logical array 1 0 1 0 1 1

1.000000 0.000000 1.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000

3   Fail
v=rand(6,1)-0.25 tf=isMandelbrot(v); tf_expected=v<=0.25; % non-imaginary range [-2.0,0.25] assert(isequal(tf,tf_expected),sprintf('\n%f %f %f %f %f %f',v,tf,tf_expected))

v = 0.434282134971830 0.302309080655364 0.439999870398845 0.311323418773247 0.193631741667028 0.387028787414020 tf = 6×1 logical array 1 0 1 0 1 1

0.434282 0.302309 0.440000 0.311323 0.193632 0.387029 1.000000 0.000000 1.000000 0.000000 1.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000