Lesson goal: For loops and plotting the Lorenz Attractor

Previous: Graph a function | Home | Next: Animate a single pixel

Sometimes plotting mathematical equations is outright fun. The patterns that can be created are like no other. From the field of "dynamical systems and fractals," there is a system called the "Lorenz Attractor." There are three equations that govern it, one for $x$, one for $y$ and one for $z$, which are: $$x=x+d(a(y-x)),$$ $$y=y+d(bx-y-xz),$$ and $$z=z+d(xy-cz).$$

where $a$, $b$ and $c$ are constants. $d$ is also a constant, that must be small, like $d=0.01$. Here, $x$, $y$, and $z$ are coordinates that may be plotted using pset versus one another. Starting $x=1$, $y=1$, and $z=1$, choose values of $a$, $b$, and $c$, and see if you can plot the Lorenz Attractor. (Hint: Try $a=10$, $b=28$, and $c=8/3$ to start out. Use pset to plot $x$ vs $z$.)

Now you try. Try fixing the x=, y= and z= and the pset statements to plot the Lorenz Attractor.

Type your code here:


See your results here: