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:
- Simulate a two-dimensional ODE correctly.
- Visualize the model in both the phase plane and the time domain.
- Interpret the role of nullclines, equilibria, and transient or oscillatory behavior.
Choose one of these models for the full assignment:
- Van der Pol oscillator.
- FitzHugh–Nagumo model.
Required
- Write one Python script that opens a figure for your chosen model.
- Plot the nullclines and the equilibrium point.
- State whether the equilibrium is stable or unstable.
- Animate one trajectory in the phase plane using a line and a moving point.
- 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:
- What qualitative behavior did your chosen model show, convergence, oscillation, or excitability?
- How do the nullclines help explain the trajectory geometry?
- 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.
Reference implementations are available in amlab/odes_2d/cdima.py, amlab/odes_2d/van_der_pol.py, and amlab/odes_2d/fitzhugh_nagumo.py.
Good luck.