# Problem 56215. Calculate pi using the Mandelbrot Set.

The Mandelbrot Set is a set of complex numbers built around a simple iterative equation for which the orbit of the critical point remains bounded. The iterative equation is .
For any complex c, we can continue this iteration until either diverges, meaning , or it converges such that . To visualize this set, all those values of c in which converge are plotted in the complex plane. Thus having the following image:
What is amazing about this set is that it has several properties related to famous mathematical concepts such as the bifurcation diagram of the logistic map, the Fibonacci sequence and π. In 1991, Dave Boll was trying to convince himself that the single point (also called the Mandelbrot Set's Neck), shown in the diagram above, connected the cardioid and the disk to its left, and had zero thickness. In order to do this, he was seeing how many iteration points of the form went through before scaping the set (meaning ), with ϵ being a small number. This same procedure works when approaching a small real number ϵ to the point (also called the Mandelbrot Set's Cusp). You will see that as ϵ decreases, the number of times that the Mandelbrot Set's equation has to be iterated in order that for or approaches the digits of π.
In this task we will compute what Dave Boll did using the Mandelbrot Set's Cusp (to work with real numbers). To do so, we will create a function that takes an input x corresponding to the number of times we will decrement ϵ by 100, beginning with (no decrement). It outputs the number of times n it will take for to be greater than two when iterating the recursive equation with with . For example:
if x == 1
epsilon = 1e-3;
elseif x == 2
epsilon = 1e-5;
...
end
Then we will iterate the following:
z = 0;
z = z + 1/2 + epsilon;
Until it diverges or becomes greater than 2. Finally, we will output the number of times n it took it.

### Solution Stats

100.0% Correct | 0.0% Incorrect
Last Solution submitted on Nov 02, 2022