physics logo
Physics Practicals

Python: Chaos

PHY180 Module 11 - PHY180 Student Guide April 18, 2023, 2:27 p.m.

Table of contents

    Note: for this set of activities you do not need to worry about uncertainties. We don’t have time to explain uncertainties with regards to programming.

    Activity 1

    A double pendulum consists of two identical rods, one of which can pivot from the bottom of the other. If the pendulum has enough energy it exhibits chaotic behaviour. Initial definition of chaos: extreme sensitivity to initial conditions. You have access to a Python program which numerically integrates a double pendulum twice with slightly different initial conditions. Run it with the following two sets of initial conditions:
        • Released from rest, both with an angle of 0.1 radians (this should be the default setting)
        • Released from rest, both with an angle of 2.5 radians
    The first set of initial conditions does not exhibit chaotic behaviour, but the second one does. You should read the Python code, and the comments, to make sure you know what the graphs represent. How do the graphs show that one was non-chaotic while the other was chaotic?

    Always using similar initial conditions (released from rest, same initial angles), find the critical angle at which chaos starts to appear. Find the angle to 2 significant digits. Explain why you think that that is the critical angle.

    Activity 2

    When you find the solution to a set of ODEs using two sets of initial conditions which differ only by a small amount, you typically find one of two results: either \(|y_1(t)-y_2(t)|\) diverges exponentially or it does not. Since exponential functions increase very quickly, this makes a good mathematical definition of chaos: if two arbitrarily close sets of initial conditions diverge exponentially, the system is chaotic. If we write the equation as \(|y_1(t)-y_2(t)| = f(t)\, e^{\lambda t}\)  then we call the constant λ the Lyapunov exponent (after Aleksandr Lyapunov). Note that we never care about f(t) (which is usually impossible to calculate), we only care about the exponential behaviour.

    Find the Lyapunov exponent of the double pendulum for various different initial conditions. Sketch the Lyapunov exponent as a function of initial conditions. Is it a constant of the system or does it depend on the energy? Qualitative answers for this are fine.

    The Lyapunov exponent can be interpreted as a time constant which measures the time-scale over which the system becomes chaotic. Fix the initial conditions so that the system is chaotic, and then adjust the size of the difference in initial conditions. Sketch a graph of how long it takes for the two systems to become visibly different (y-axis) as a function of difference in initial conditions (x-axis). This graph will be most helpful if you make it a semi-log plot.

    Use what you have learned to answer the following question. Weather is a chaotic system. The time-scale for weather systems the size of a typical storm is measured in hours. If we had better measurements (pressure, temperature, etc.) we could make more accurate forecasts. Right now, we can usually predict storms for about 2 days. If we spent a huge amount of money to improve our measurements by an order of magnitude, how much longer would our forecasts be accurate?

    Activity 3

    If you run the integration twice using exactly the same initial conditions both times, what happens? Explain what is meant by the statement: A chaotic system is deterministic.

    Now run the integration twice using exactly the same initial conditions but this time change the step size of the integrator by a factor of 2. Now what happens? Explain your observations based on what you have learned of chaos.

    Write down a better definition of chaos than was given at the beginning of this document. Your definition should address the following issues: 

    • Does chaotic mean random?
    • Does chaotic mean unpredictable?
    • Define "extreme sensitivity" more mathematically.
    last modified: April 18, 2023, 2:27 p.m.