Cody

Problem 785. Mandelbrot Number Test [Real+Imaginary]

Solution 116460

Submitted on 20 Jul 2012 by Cris Luengo
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))

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.400952116680970 - 0.097790959234675i -0.422176663403923 + 0.105712814427559i -0.007071044299334 - 0.014561287906923i -0.374717577853607 + 0.063350961155133i -0.313687639407432 - 0.145860393481425i -0.260340287818347 - 0.054195853948413i

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.078926545224931 0.330533513352520 0.026764193110911 -0.157955541093481 0.010636248760882 0.587198596161596