Practice: Budworm App
Module 1: Low-Dimensional Dynamics
This is ungraded practice. It turns the Session 3 workflow into a complete mini-project: a scalar ODE, its equilibrium structure, numerical integration and an interactive front end (Strogatz 2024, sec. 3.7).
Use these pages as guides:
Budworm: the Model in Code Budworm: Integration and Time Series Budworm: a Streamlit App
Goals
Your work should show that you can:
- implement the budworm model and its plots;
- build an app that evolves the dynamics correctly;
- interpret equilibria, bistability and hysteresis.
Tasks
- Implement
spruce_budworm()and the plotting helpers. - Build a Streamlit app with the rate plot, the time series and an “Evolve” button.
- Use
st.session_stateso the simulation persists across interactions. - Answer at least three of the experiment questions, with figures.
Short discussion
Write a few paragraphs that answer:
- How many equilibria appear for the parameter values you explored?
- Did different initial conditions converge to different long-run states?
- Did you observe hysteresis or threshold behaviour?
Optional extension
- Put the project in a GitHub repository with a short report.
- Deploy the app and share the link.
- Add a reset button or multiple trajectories.
- Implement Euler or a Runge-Kutta method yourself and compare with SciPy.
Tips
- Start with the ODE and the static plots before you build the app.
- Test each function separately.
- Keep the session state logic simple before adding features.
- Compare with the reference code in amlab/odes_1d/spruce_budworm.py.
Next
Strogatz, Steven H. 2024. Nonlinear Dynamics and Chaos: With Applications to Physics, Biology, Chemistry, and Engineering. Chapman; Hall/CRC.