Assignment

ODEs in 2D

You will build a Matplotlib animation for one planar ODE model (Strogatz 2024; Hunter 2007). The goal is to connect the geometry of the phase plane with the time evolution of the solution.

You can use these pages as guides:

CDIMA Reaction Van der Pol Oscillator FitzHugh–Nagumo Model Animation Template

Summary of Goals

Your submission should show that you can do three things:

  1. Simulate a two-dimensional ODE correctly.
  2. Visualize the model in both the phase plane and the time domain.
  3. Interpret the role of nullclines, equilibria, and transient or oscillatory behavior.
Model Choice

Choose one of these models for the full assignment:

  1. Van der Pol oscillator.
  2. FitzHugh–Nagumo model.

Required

  1. Write one Python script that opens a figure for your chosen model.
  2. Plot the nullclines and the equilibrium point.
  3. State whether the equilibrium is stable or unstable.
  4. Animate one trajectory in the phase plane using a line and a moving point.
  5. Add a second subplot that animates one variable as a function of time.

Use the pipeline from CDIMA Reaction as the structural template, and adapt it to your chosen system. Use Animation Template for the animation logic.

Short Discussion

Include a brief paragraph that answers these questions:

  1. What qualitative behavior did your chosen model show, convergence, oscillation, or excitability?
  2. How do the nullclines help explain the trajectory geometry?
  3. Which parameter had the clearest effect on the behavior you observed?

Optional Extensions

  • Make the figure interactive so clicking on the phase plane resets the initial condition.
  • Compare two parameter values in the same report.
  • Add a short explanation of the fixed-point stability from the Jacobian or the observed flow.

Tips for Success

  • Start with a static phase-plane plot before you animate anything.
  • Reuse the CDIMA structure instead of writing the whole script from scratch.
  • Test the ODE, nullclines, and fixed point separately.
  • Keep the first animation simple, then add labels or interaction.
  • Use the model page to decide which variable to show in the time subplot.
Tip

Good luck.

References

Hunter, John D. 2007. “Matplotlib: A 2D Graphics Environment.” Computing in Science & Engineering 9 (3): 90–95. https://doi.org/10.1109/MCSE.2007.55.
Strogatz, Steven H. 2024. Nonlinear Dynamics and Chaos: With Applications to Physics, Biology, Chemistry, and Engineering. Chapman; Hall/CRC.