[Edu-sig] Fractals

kirby urner kirby.urner at gmail.com
Fri Apr 28 02:59:23 CEST 2006

So one of my high schoolers wants to use Python to understand
Fractals?  What should we do?

Per my opener for Mandelbrot that time (a PowerPoint, done on short
notice for Terry, when the originally scheduled talent bailed) I broke
it down into sequences and their characteristics.

Sequences may be reiterative, meaning they feed back into themselves
(Fibonaccis the classic example).

Sequences may be convergent, meaning they approach a value.  Or
divergent, meaning they go huge (more should be said).  Or oscillatory
(regular repeating sequence).  Or chaotic, which is the "irrational
number" like sequence:  not divergent, not oscillatory, never settles
down, never converges.


So then as an example of chaotic, we should import from cmath and
simply explore the feedback loop z = z**2 + c for convergence or
divergence.  Actually, we don't really need cmath

It's not that this loop is chaotic.  It's that the boundary in between
the convergent and divergent sequences it generates is chaotic.

Two complex numbers, arbitrarily close together, may diverge in
whether they converge or not, or on how fast they diverge (a source of
color differences).

>>> def seq(o=0j, z=1+1j):
	while True:
		yield o
		o = o**2 + z

>>> g = seq()
>>> for i in range(10): print g.next()  # divergent!


>>> g = seq(z=0.1+0.1j)
>>> for i in range(10): print g.next()  # convergent!



More information about the Edu-sig mailing list