j-orlin-grabbe

Iterative Plot of Grow Brain

 

Modern browsers do not support this action!


Wait a minute for the applet to run. This amazingly complex structure is created by the simple iteration of the two equations:

X = Y - (X/|X|)*sqrt(|aX|)
Y = b - X

(Here "sqrt" means to take the square root.)

The first series of iterations here starts with the initial values X = .9 and Y = 0. The two equations are then iterated 10,000 times, plotting each (X,Y) point of the iteration. Then the starting value for Y is increased slightly, and another 10,000 plots are plotted (see the Java source code for details).

By varying the parameter a in the first equation above (aX is set at 1.53 X for the applet supplied here), and also the rate at which the starting value for Y is increased (set Y = .025*col, say, instead of Y = .047*col), different structures can be obtained.


The Java source code.

import java.applet.*;
import java.awt.*;
import java.lang.Math.*;

class GrowBrainPlot extends Canvas {

        private int maxcol = 75, maxrow = 10000, max_colors = 16;
                
        private Color cmap[];

        private void plot(Graphics g, int x, int y, int color_index) {
                
                g.setColor(cmap[color_index]);
                g.drawLine(x,y, x,y);
        }

        public GrowBrainPlot() {

            cmap = new Color[max_colors];
            cmap[0] = Color.black;
            cmap[1] = new Color(0, 0, 168);
            cmap[2] = new Color(100, 50, 0);
            cmap[3] = new Color(0, 168, 168);
            cmap[4] = new Color(168, 0, 0);
            cmap[5] = new Color(168, 0, 168);
            cmap[6] = new Color(168, 84, 0);
            cmap[7] = new Color(168, 168, 168);
            cmap[8] = new Color(84, 84, 84);
            cmap[9] = new Color(84, 84, 255);
            cmap[10] = new Color(84, 255, 84);
            cmap[11] = new Color(84, 255, 255);
            cmap[12] = new Color(255, 84, 84);
            cmap[13] = new Color(255, 84, 255);
            cmap[14] = new Color(255, 255, 84);
            cmap[15] = Color.white;
        }

        public void paint(Graphics g) {

                double X, Y, Xfactor, Yfactor;
                int color, row, col;

                color = 4;
                for (col=0;col<=maxcol;col++) {
				color++;
			      if(color==15) color=0;
				X= .9; Y = .047*col;
                        for(row=1;row<=maxrow;row++){
                                Xfactor = X;
                                X = Y - (X/Math.abs(X))*Math.sqrt(Math.abs(1.53*X));
                                Y = 3.5-Xfactor;
                                plot(g,(int)(150+50*X), (int)(290-40*Y),(int)(color%max_colors));
                        }
                 }
        }
        }          

        public class GrowBrain extends Applet {

                private GrowBrainPlot canvas;
                
                public void init() {

                        setLayout(new BorderLayout());
                        canvas = new GrowBrainPlot();
                        add("Center", canvas);
                        }

        }               

orlin-grabbe-dot-com