Cody

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

Solution 106577

Submitted on 5 Jul 2012 by Vitaly Lavrukhin
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))

``` ans = 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.458089311001534 + 0.248067358313443i -0.385511515641591 - 0.210912235623408i -0.043331319249165 - 0.028660865112277i -0.423810990515389 - 0.196673614909708i -0.087091511255226 + 0.230949040427527i -0.230828782369971 - 0.247682887932966i 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.524910464711502 0.567303220653433 0.618694705363510 -0.165564154489090 0.149782649098896 0.009870402850654 ans = 0 0 0 1 1 1 ```