chaos

An example of chaos in jupyter notebook using numpy (numerical python), adapted from chapter 1 of Zelle's "Python: an Intro to CS" book.

For more information on this "logistic map", ee https://en.wikipedia.org/wiki/Logistic_map .

Jim Mahoney | cs.bennington.college | Sep 2020

First, here is the graphics program as it is in Zelle's book, which is online at https://mcsp.wartburg.edu/zelle/python/ppics3/code/chapter01/ . It asks for a number (I typed 0.3) then prints out ten values.

Notice how this notebook is made up of "cells", and that each cell can be one of several types. The ones we'll use most often are markdown cells, with formattable text (like this one), and python code cells (like the cell above this).

One of the things that these notebooks are often used for is numerical work, including making plots. After storing the x values in a list (which we'll be talking more about soon), we can use some graphics libraries to make plots.

And just to keep things very simple, I'll just put the values into the cells explicitly rather than asking for them with "input". Then to see a different plot, I edit the cell and evaluate it again.

Here we go.

Now that we have calculated a list of values, let's plot them.

(The specifics of all this aren't really the point right now. We'll be learning about these sorts of interfaces as the course goes on. Once you understand the syntax, it's mostly a matter of reading the documentation to see what's possible, and asking the software nicely to do something. Googling for example "jupyter plots" would lead you to the docs.)

Now edit the value of $\alpha$, re-evaluate the python cells, and see the new plot. 🙂