home *** CD-ROM | disk | FTP | other *** search
- CubeRoot Documentation 16 March 1992, by Steve Markham
- ======================
-
- This document describes the CubeRoot module for inclusion with the AFG
- !Fractal application.
-
- Overview
- ========
-
- CubeRoot is a plotting routine which maps the cube roots of 1 onto the
- complex plane. It uses Newton's algorithm of successive approximation to map
- the way in which the three roots attract points on the complex plane.
-
- The three basins of attraction surrounding the roots are presented in
- colour, the tint of the colour representing the number of iterations that
- the routine takes before the initial point converges to one of the roots.
-
- A fractal boundary exists between the basins of attraction which has the
- curious property that wherever two colours try to come together, the third
- colour intervenes.
-
-
- The algorithm
- =============
-
- The number "1" has three cube roots. In complex notation they are at:
-
- 1+i0; -0.5+i.8666..; -0.5-0.8666.. where 0.86666...is SQR(3)/2.
-
- For real numbers Newton's method successively iterates:
-
- Let x=a be an approximation to the solution of equation f(x)=0.
- Let x=a+h be the accurate solution i.e. f(a+h)=0.
- If x=a is a good approximation then h will be small.
-
- Thus f(a+h) is approximately equal to f(a)+hf'(a),
- i.e. 0 is approximately equal to f(a)+hf'(a),
- h is approximately equal to -f(a)/f'(a)
-
- where f'(a) represents the first derivative of f(a). If x=a is a reasonably
- good approximate root of an equation f(x)=0, then x=a-f(a)/f'(a) is a closer
- one. The iteration process is repeated until the value of f(a)/f'(a) reaches
- an arbitrarily small value i.e. the error between the current of x and the
- exact root is very small.
-
- The process above can be applied equally well to complex numbers (although
- the algebra gets more complicated!), and by using the computer to do the
- calculations the initial approximations do not have to be at all close to
- the roots.
-
- From the above it should(?) be clear that approximations close to the roots
- will converge quickly and this is the case. For other values, the iteration
- process bounces around chaotically before finally converging.
-
- The implementation
- ==================
-
- The initial equation is: (rx+iy)^3=1 where r and i are the
- or (rx+iy)^3-1=0 coefficients of the real
- and imaginary components x,y.
-
- Expanding (rx+iy)^3 for the coefficients yields:
-
- Real part M=2i(r^2)+i(r^2-i^2)
- Imaginary part N=r(r^2-3i^2)-1
- 1st derivative, real T=3(r^2-i^2)
- 1st derivative, imaginary U=6ir,
-
- and for the error calculation f(x)/f'(x):
-
- numerator real nr=NT-MU
- numerator imaginary ni=TM-NU
- denominator den=T^2-U^2,
-
- hence error(real) err=nr/den
- error(imaginary) eri=ni/den
-
- For the next iteration r(next)=r-err
- i(next)=i=eri
-
- During the iteration process, some of the numbers become very large, due to
- the fact that the initial values are a long way from the root, or the guess
- may lie on the fractal boundary.
-
- For this reason integer arithmetic of the int_27 type is not applicable.
- CubeRoot uses double precision floating point arithmetic throughout. (If you
- can think of a better way let me know!)
-
- The routine takes about 6 minutes with an ARM 3 to plot (about twice as fast
- as BASIC).
-
- The number of iterations taken to converge is presented as a variation in
- the tint of the colour of the point. The colour is the same as the main
- field where the root lies. The presentation of the tints is cyclic; there
- are only four tints available. No doubt this could be improved.
-
- Other points
- ============
-
- The CubeRoot plotter includes some error checking for initial values.
- Although the routine will cope with very large values for r and i, the
- interesting area lies around the roots. For this reason, r and i and limited
- to +/- 4.
-
- The resolution of the plot is controlled by the value assigned to the error.
- A minimum value of 1E-15 is the smallest I have tested, and is set as the
- minimum allowable.
- ==========================================================================
-
- This module was written by
-
- S.Markham
- 28,High Street,
- Over,
- CAMBRIDGE CB4 5ND
-
- For the AFG.
-