BACK
Lab 5: Fractal basins

 

Section 1: Basin Boundaries.  The Julia set.

1.1 Basin of attraction.  In the study of various dynamical systems, we attempt answer the question about the eventual fate of the system, or its asymptotic state.  As we have seen in the previous Labs, the asymptotic states can be stable (or attracting) fixed point, periodic and chaotic orbits, or infinity, which can also be considered an attracting fixed point.  Very often dynamical systems have several attracting asymptotic states, so orbits starting from different initial conditions may converge to different asymptotic states.  Therefore, in order to answer the question about the eventual fate of the system, not only do we need to find all possible asymptotic states, but also to determine which initial conditions converge to each asymptotic state.  To this end, we define the basin of attraction of an asymptotic state:

Definition: The set of all initial conditions from which orbits converge to a given asymptotic state is called the basin of attraction of that state.
For example,  consider the map xn+1 = xn2 .  It is clear that any orbit starting within the interval (-1, 1) converges to 0, which is the stable fixed point of this map.   Therefore, the interval (-1, 1) is the basin of attraction of the fixed point x* = 0.  Any orbit originating outside this interval escapes to .  So the basin of attraction of  is given by (-, -1)  (1, ).

1.2 Basin boundaries.  In the above example,  the two basins are separated by points x = -1, and x =1, which do not belong to either of the two basins.  Indeed the point x = 1 is itself an unstable fixed point, while x = -1 is mapped to the fixed point x = 1 on the next iterate, and so it is called an eventually fixed points.   In general, orbits starting from points exactly on the basin boundaries, always remain on the boundaries. Identifying the basin boundaries allows us to determine the eventual state of the orbit starting from any initial condition.

In the example above, the basin boundaries consist of only two points and are, therefore very simple.  However, there are many dynamical systems where the basin boundaries may have a very complicated fractal structure.

1.3 Complex maps. Very often 2-dimensional maps can be written as maps of a single complex number z = x + iy, where i is the imaginary unit and x and y are two real numbers representing real and imaginary parts of z.

Q1 Show that the complex map
zn+1 = zn2
is equivalent to the 2-dimensional map
xn+1 = xn2 - yn2 yn+1 = 2xn yn
where zn = xn + iyn.

Q2 The map zn+1 = zn2 has a stable fixed point at z = 0. Show that the basin of attraction of this fixed point is the interior of the unit circle |z| < 1 in the complex plane. Show that any orbit starting outside the unit circle escapes to infinity.
Hint: consider the absolute value of the map iterates |zn|.

Definition: The Julia set of a complex function h(z) is the boundary of the set of points whose orbits escape to infinity under the iteration of the map  zn+1 = h(zn).  In other words, the Julia set is the boundary between the escaping orbits and those that never escape.
Thus, the unit circle |z| = 1 is the Julia set  of the complex function h(z) = z2.

It turns out that such a simple structure of the Julia set is exceptionally rare.  Typically, the Julia sets have much more complex structure, which is often a fractal.

1.4 The Julia set of the function z2 + c. Consider the function h(z) = z2 + c, where c = a + ib is a constant complex number.  Let us use Matlab to determine the Julia set of this function.  The nice thing about Matlab is that it understands complex numbers just as well as it does the real ones.  The basic idea is to consider points on a dense grid in the complex plane as starting points for orbits of the map

zn+1 = zn2+ c,
and colour them according to the number of iterates required for the orbits to escape beyond the circle of a certain radius (say 10).   Before we consider a program that implements this idea, it is necessary to create a couple of Matlab function which will be used by the program.   One of the functions, plotcolour(x, y, col), allows you to plot dots with coordinates (x, y) coloured according to the values in the array col. Another function, pixgrid(n), allows you to re-size the figure in such a way that every pixel on the computer screen corresponds to one grid point.  In this function, n is the size of the plotted array.  To create the functions, click on the links above and use 'Save As' in the File menu to create files plotcolour.m and pixgrid.m in your working directory.  If it doesn't work, just copy and paste from the Explorer into a file with the specified name.

Program 1

c = 0.36 + i*0.1;
x = -2:0.02:2; y = -2:0.02:2;
[x0, y0] = meshgrid(x,y);
n = zeros(size(x0));
for k = 1:length(y),
  for m = 1:length(x),
    z = x0(k,m) + i*y0(k,m);
    for itr = 1:30,
      z = z.^2 + c;
      if abs(z) > 10,
        n(k,m) = itr; break,
      end,
    end,
  end,
end,
plotcolour(x0,y0,n);
pixgrid(size(x0));
 

Comments to the program:

The Julia set of a function is the boundary between the coloured and the black regions.
Q3   Check that the Julia set of the function with c = 0 is indeed a unit circle.   Construct plots of the Julia set for parameter values, c = 0.255, c = -1, c = 0.360284 + i*0.100376, c = -0.1 + i*0.8.  You can also modify the values of the grid coordinates to zoom in on a particular region of the set.  For example, try c = 0.4 + i*0.1, and x = 0:0.004:1; y = 0:0.004:1;
Note: No report is required for this exercise.  Simply explore various shapes of the Julia set and appreciate their complexity.

 

Section 2: The Newton-Raphson method.

2.1 The Newton-Raphson method for functions of a single variable.  Consider the problem of locating roots of some function f(x).  That is, we want to find solutions to the equation

f(x) = 0

There are many functions where such roots cannot be found analytically.  However, we can still look for such solutions using numerical procedures.  One such procedure was introduced by Isaac Newton over 300 years ago and successfully used long before the advent of computer age.  The idea is to start from an initial point x0 which is reasonably close to the solution.  Then a line tangent to the function f at the point x0 a is extended until it crosses the horizontal axis.  The crossing point x1 is used as the next estimate for the solution.  We can easily determine x1 from the fact that the slope of the tangent line is, on one hand, equal to the ratio f(x0)/(x0 - x1) and, on the other hand, to the derivative of the function f'(x0).  Thus

 f(x0)/(x0 - x1) = f'(x0)    or   x1 = x0 - f(x0)/f'(x0).

Repeating the same procedure at the point x1, we obtain the next estimate of the solution according to the formula

 x2 = x1 - f(x1)/f'(x1).

It is easy to see that the procedure of the Newton-Raphson method for locating roots of the function f(x) is nothing else but a map  xn+1 = N(xn), where N(x) = x - f(x)/f'(x).  To understand how the Newton-Raphson method locates the roots of the function f(x), we can study the map N using methods of the dynamical systems theory.

Q4 Show that every root x* of the function f is a fixed point of the map N.  Show also that every fixed point is superstable, that is, that N'(x*) = 0.
2.1 The Newton-Raphson method for complex functions.  The Newton-Raphson method works just as well for complex functions.  In fact, the program for determining the basin of attraction of a given root is very similar to Program 1 for computing the Julia sets.  Consider Program 2 which computes the basin of attraction of the root z = 1 of the complex function f(z) = z3 - 1.  The coloured region is the basin of attraction of the root z = 1;

Program 2

x = -3:0.03:3; y = -3:0.03:3;
[x0, y0] = meshgrid(x,y);
n = zeros(size(x0));
for k = 1:length(y),
  for m = 1:length(x),
    z = x0(k,m) + i*y0(k,m);
    for itr = 1:30,
      z = z - (z.^3 - 1)./(3*z.^2);
      if abs(z - 1) < 1e-5,
        n(k,m) = itr; break,
      end,
    end,
  end,
end,
plotcolour(x0,y0,n);
pixgrid(size(x0));

Comments to the program:

Lab Report No. 5 is due on Thursday, May 22th at 11:30am.

BACK