Math 171 - Alexiades
                Fractals
There is an excellent article about fractals on Wikipedia.

A. Brief background about fractals
Roughly, fractals are sets (patterns) that are "self-similar" at (many or all) scales. Zooming in, similar patterns appear.
  • Given a sequence of numbers {zn} generated by some formula zn = f(n), as n → ∞ ,
      either the sequence converges (towards some limit) or it diverges, e.g. tends to ±∞ .
  • If a sequence is defined recursively (iteratively), i.e. the next term is determined
      from the previous term(s), then with different starting value(s), the convergence
      behavior of the sequence may be different.
    The orbit of a starting point z0 is the set of its iterates {z0, z1, z2, ..., zn, ... }
  • A very important class of recursions are of "fixed point type": z = g( z ) for some function g(z).
      Then the orbit of a starting z0 is generated by iterating the function g:  zn+1 = g( zn ) , n=0,1,2,...
      For example, taking g(z)=z2, the sequence will be generated by: zn+1 = zn2,
      i.e. one squares the current term to get the next term.
      For this sequence, if we start with any value z0 with   |z0| < 1 then the orbit converges to 0.
      If we start with any value z0 with |z0| > 1 then the orbit diverges (to infinity). Try it! can you see why?
  • If a sequence is defined recursively by a formula involving a parameter, like zn+1 = g( zn , c )
      then for different values of the parameter c the behavior of orbits may be different.
  • Quadratic Recursion: Consider the sequence generated recursively by zn+1 = zn2 + c ,
        with c complex (so all zn will also be complex).
      Then we can:
      (1) fix c and look at the behavior of orbits of various starting values z0.
        The "filled-in" Julia Set is the set of starting points whose orbit does not diverge.
      (2) fix z0 and look at the behavior for various c. The Mandelbrot Set is of this type.
      Look them up on wikipedia.

    Since each complex number z=x+iy corresponds to a point (x,y) on the xy-plane, we can plot points using various coloring schemes.
    Escape-time-algorithm coloring scheme: provides a nice coloring scheme to display fractal shapes.
      We pick an "escape radius" R, and color starting points z ( = z0) according to number
      of iterations it takes for the orbit to "escape" (get outside the circle of radius R):  
    if |zk| > R then the k-th iterates escaped.
      The ingredients are:
  • window: choose a rectangular window of dimensions W × H , for −W < x < W and −H < y < H
  • grid: choose Mx grid points for x ∈ [−W , W] and My grid points for y ∈ [−H , H].
      Construct an x-grid and a y-grid.
      Then z-grid points are   zij=( xi , yj ). = xi + i yj (as complex number).
      We take each z-grid point as starting point, z0, and compute its orbit z0, z1, z2, ... , zk, ...
      For simplicity, one can use a square window by taking H=W and My=Mx=M.
  • maxIT = number of ITerations to allow.
  • coloring scheme: Choose Ncolors = number of colors in the pallet (e.g. 64 or 128 or 256).
      If the k-th iterate of z0 escapes, we color the starting point z0
      by scaling relative to the number Ncolors:   color = Ncolors ( 1 − k / maxIT ).