How can I write a piece of Python software that estimates the fractal dimension of the Mandelbrot set?

318 Views Asked by At

My lecturer said it would not be possible to extend the below programme to be able to estimate the fractal dimension of the Mandelbrot set. Can anyone explain why he would think this is not possible? And what can I add to the below programme to account for an estimate of this and thus prove him wrong? The Mandelbrot set is new to me and my understanding of it (other than how it is generated) is basic.

I already have the following piece of working software that estimates the area of the Mandelbrot set:

import random
import cmath

npoints = 1000
maxiter = 10000

noutside = 0
for i in range(0,npoints) :
    trialp = complex(-2.0 + 2.5*random.uniform(0,1),1.125*random.uniform(0,1))
    zn1 = trialp
    for j in range(0,maxiter) :
        zn1 = zn1*zn1 + trialp
        r, thet = cmath.polar(zn1)
        if r > 2 :
            noutside = noutside + 1
            break

ninside = npoints - noutside
area = 2.0*(2.5*1.125) * ninside / npoints

print( ninside, area )
1

There are 1 best solutions below

0
On

I don't think you can find dimension by random sampling.

For example, box counting dimension takes into account locality of points to each other as the box size decreases.

Besides, it is obvious that the Mandelbrot set has dimension $2$ because it contains solid regions (like the disc radius $\frac{1}{4}$ centered on $-1$).

Its boundary has dimension $2$ also, this is not obvious, and using binary inside/outside classification (as opposed to far-interior/near-boundary/far-exterior) would probably give you a different answer as the filaments contribute a lot to the boundary.