Cody

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

Solution 194329

Submitted on 21 Jan 2013 by Alfonso Nieto-Castanon
• Size: 22
• This is the leading solution.
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.142598825107607 - 0.189553632838444i -0.158453583558301 + 0.172092884277037i -0.129378864369066 - 0.134893955842077i -0.470573450890637 - 0.162715837784445i -0.427989118931810 + 0.234914356835612i -0.213121886930020 + 0.205595336135288i

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.131628851583986 -0.213891427947158 0.626770492120073 0.631661062073736 -0.172529726718799 -0.207116962856202