Cody

Problem 785. Mandelbrot Number Test [Real+Imaginary]

Solution 2141424

Submitted on 26 Feb 2020 by Paul Morant
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))

N = 6×1 logical array 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.213625392416654 + 0.231125230391772i -0.178398035874775 + 0.009694426379102i -0.317734743046519 + 0.104441864487669i -0.016347603625972 - 0.225061585187303i -0.498046486343154 - 0.059165356746353i -0.200866137093517 + 0.062495372374922i N = 6×1 logical array 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.363870672505757 0.406796848023050 -0.023191655641279 0.276061888852866 0.456454851171930 0.666959002792814 N = 6×1 logical array 0 0 1 0 0 0