Hidden Pi inside Mandelbrot Set
Mandelbrot Set and
Our goal today is to see how this two are related.
A poem of
In realms where numbers twist and twine,
Pi and Mandelbrot align.
Pi, with digits endless, pure,
A constant rhythm to endure.
Mandelbrot’s fractals, wild and vast,
Patterns in a boundless cast.
Together, they reveal the lore,
Of nature's dance, forevermore.
In infinite math, their beauty lies,
A timeless waltz beneath the skies.
Introduction to Mandelbrot Set
Before starting let's first reacp what is Mandelbrot Set?
In the most simple term, The mandelbrot set is the set of all complex numbers
for which doesn't goes to infinity when iterated from .
Let's try to understand it using a example.
Suppose, we have a number
Then,
We start with
and put it into which gives us .Then, we set the result
as and use it as the new input of . This gives us .In theory we repeat this process for infinite number of times. If the output goes to infinity, then the number is not inside mandelbrot set. In our case the results are
, i.e., it keeps on increasing. So, is not inside mandelbrot set.
If we had taken
Hence,
I hope this idea is now clear. It should be clear that
Let's see a code for checking if a number is inside the set. Here we will check the iteration outputs upto
function mandel_check(c,max_ita=1000)
z = 0
for i in 1:max_ita
z = z^2 + c
if abs(z) >= 2
print(c," is not in mandelbrot set upto set iter no.")
break
else
if i==max_ita && abs(z)<2
print(c," is in mandelbrot set upto set iter no.")
end
end
end
end
mandel_check(1)
The output is:
1 is not in mandelbrot set upto set iter no. For mandel_check(0.3+0.2im)
0.3 + 0.2im is in mandelbrot set upto set iter no. Here is a image. You can zoom and change iteration number and also save the image.
Pi hidden in Mandelbrot Set
Around
He described that we while he was trying to see how many iteration are needed for
| # of iteration | |
|---|---|
| 1 | 3 |
| 0.1 | 33 |
| 0.01 | 315 |
| 0.001 | 3143 |
| 0.0001 | 31417 |
| 0.00001 | 314160 |
| 0.000001 | 3141593 |
and so on. WoW!!... Are those digits of pi! what the heck!
Rather than
Let's see the table for this
| # of iteration | |
|---|---|
| 0.1 | 8 |
| 0.01 | 30 |
| 0.001 | 97 |
| 0.0001 | 312 |
| 0.00001 | 991 |
| 0.000001 | 3140 |
| 0.0000001 | 9933 |
| 0.00000001 | 31414 |
| 0.000000001 | 99344 |
| 0.0000000001 | 314157 |
Again, we see the same pattern but only for
Let's write a code to verify this:
function cal_pi(epsilon)
setprecision(300)
c = BigFloat(0.25) + BigFloat(epsilon)
z = BigFloat(0.0)
steps = 0
while abs(z)<2
z = z^2 + c
steps += 1
end
return steps
end
Here the function takes
epsilon = 0.01
print("For epsilon = ",epsilon," irter needed = ",cal_pi(epsilon))
The output is
For epsilon = 0.01 irter needed = 30
If we needs
n=7
epsilon = BigFloat(1/10^(2*n))
print("Approx n = ",n," correct digits of pi = ",cal_pi(epsilon))
which gives,
Approx n = 7 correct digits of pi = 31415925
But why does it works?, let's try to find that out!...
Why it works?
As we are seeing this for
So, we have ,
we will start with
The function is just a parabola. It's plot it as it will give us insight.
The answer is simple. Let's understand it in following steps.
We start the iteration with
. This represent the point .Then, we take
, which is our y-coordinate as the new input. So, basically, we are converting this into . This is done by drawing a line parallel to the x-axis.The new input is then the x-axis of the intersection of that green line and
. To represent that we draw a line parallel to the y-axis until it hits the parabola.Then we repeat the process.
This visually shows us the iteration and hence we need
Play with the slider and change the value. You will see how the iteration goes to infinity (although to save computation power, the iteration number can only go upto 20).
Now, we can write,
which can be written as
This can be approximated as,
for
Let us define
Using mathematica,
DSolve[{y'[x] - (y[x] - 1/2)^2 == \[Epsilon], y[0] == 0}, y, x]
The output is,
{{y -> Function[{x},
1/2 (1 +
2 Sqrt[\[Epsilon]]
Tan[x Sqrt[\[Epsilon]] - ArcTan[1/(2 Sqrt[\[Epsilon]])]])]}}
So, we have,
This can be rewritten as,
Taking the limit if
This reduces to,
This tells us that for
If you want to read the official published proof (which is very different from mine), then visit here . __________________________________________________
I hope you learn something new and enjoyed this article.
If you have some queries, do let me know in the comments or contact me using my using the informations that are given on the page About Me.