Cody

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

Solution 106677

Submitted on 5 Jul 2012 by Aurelien Queffurust
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 = 1 0 1 0 1 1

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.331140295089311 - 0.129154357043084i -0.049973076791169 - 0.048043927205943i -0.315376609439892 - 0.201772737415806i -0.444398622353106 - 0.184013353696832i -0.109873965839431 + 0.221025295387743i -0.305130581519373 + 0.228067270114901i tf = 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.325208595078466 -0.190220457052844 -0.015220086627594 0.103158571222071 0.571194040197959 -0.234596562348445 tf = 0 1 1 1 0 1