Cody

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

Solution 106575

Submitted on 5 Jul 2012
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   Fail
%% 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))

Error: 0.000000 0.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 0.000000 1.000000 1.000000

2   Pass
%% 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.313647517971446 + 0.043295556021409i -0.366704943405336 + 0.135748094797015i -0.208156200309197 + 0.027509840033442i -0.240448195593258 - 0.215714867710045i -0.378516398368875 - 0.221746676916155i -0.185198503539751 + 0.014945458973207i ans = 1 1 1 1 1 1

3   Pass
%% 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.007747540072916 0.627455770897208 0.428552896656094 0.697735651650256 0.413307257883198 0.130534128799689 ans = 1 0 0 0 0 1