Skip to main content

Section 2.2 Computer experimentation

It doesn't take long to realize that a little computer power will help develop intution much better than, say, doing a lot of arithmetic by hand. We'll often use Sage for basic exploration of iterative dynamics. Here are a few examples.

Subsection 2.2.1 Computing orbits

Suppose \(f(x) = \frac{1}{5}x^2 - 2x + 6\text{.}\) Here's how to compute the first five iterates of \(x_0=1\) under \(f\) using Sage:

Note that the computation is exact. That is, we get rational numbers like \(21/5\text{,}\) rather than decimal approximations like \(4.2\text{.}\) Often we would prefer decimal approximations. Let's set xi = 1.0 in the code block above and compute 100 iterates.

Sure looks like we've found a pattern! Perhaps, it's an orbit of period 2?

Subsection 2.2.2 Finding periodic orbits

Continuing with the example of the last sub-section, suppose we'd like to find all orbits of period 2 for \(f(x) = \frac{1}{5}x^2 - 2x + 6\text{.}\) I guess we should let \(F(x)=f^2(x)\) and then find all fixed points of \(F\) or, equivalently, find all roots \(F(x)-x\text{.}\) We can automate this procedure like so:

Each root is returned as a (value,multiplicity) pair. Note that the 1.38 and 3.618 agree with our prior computation; those form the orbit of period 2. The other points are fixed points. Of course, those should be the points of intersection with the line \(y=x\text{.}\) We can illustrate that with Sage too:

Sometimes we might be interested in a somewhat higher interval, in which case it might make sense to use the computer to do the iteration for us. For example, here's how to find the fourth iterate of \(f(x)=x^2-2\text{:}\)

With that in hand, we can find the orbits of period 4.

Refering to the last example?

  • What is the orbit of the first point `-1.96594619936780` in the list?

  • What do you make of the last point `2.0000000000` in the list?

Given the function \(f(x) = 7 x^2+14 x+\frac{23}{4}\text{,}\)
  1. Iterate \(f\) from the starting point \(x_0=1.0\) twenty times. What does the long term behavior appear to be?

  2. Iterate \(f\) from the starting point \(x_0=-1.0\) two hundred times. What does the long term behavior appear to be?

  3. Write down an equation that an orbit of period 3 should satisfy and solve that equation using Sage.