Module 2 capstone
An ODE Solver Toolkit and Convergence Study
Implement Euler, modified Euler, midpoint, and fourth-order Runge–Kutta. Demonstrate their convergence orders. Apply them to a nonlinear model. Diagnose a stiff case.
§ Project brief
The Module 2 capstone is a small library of ODE solvers accompanied by a full convergence study. You will implement four one-step methods, verify each against an analytical solution, estimate the observed convergence order numerically, apply the methods to a nonlinear model without a closed-form solution, and diagnose a stiff case.
The project is assessed on the correctness of the implementations, the rigour of the convergence study, and the clarity of the interpretation. A well-organised spreadsheet with a clean convergence table and a clear stiffness discussion is the target deliverable.
Implementation plus evidence
A solver that produces numbers is not a deliverable. A solver that produces numbers and demonstrates that its observed order matches the theory is.
§ Learning outcomes addressed
This capstone assesses
- Implement Euler, modified Euler, midpoint, and fourth-order Runge–Kutta.
- Verify each method against an analytical solution.
- Demonstrate the observed convergence order numerically.
- Apply the methods to a nonlinear initial-value problem.
- Perform a step-doubling error estimate in the absence of a closed-form solution.
- Recognise and diagnose stiffness.
§ Suggested models
Nonlinear pendulum
θ'' + (g/L) sin θ = 0, reduced to a first-order
system. No closed-form solution for large amplitude.
Lotka–Volterra predator–prey
x' = αx − βxy, y' = δxy − γy. Has an
invariant that can be used as a verification check.
Damped oscillator
x'' + 2ζωx' + ω²x = 0. Closed-form solution
available; useful as a verification reference.
SIR epidemic
S' = −βSI/N, I' = βSI/N − γI,
R' = γI. Conserves total population.
§ Deliverables
| Deliverable | Weight | What it should contain |
|---|---|---|
| Solver implementations | 20% | Euler, modified Euler, midpoint, and RK4 for a general first-order system. Documented, verified. |
| Analytical verification | 15% | Comparison against a closed-form solution for at least one problem, with error table. |
| Convergence study | 25% | Observed order for each method at four step sizes. Log-log plot. Comparison to theoretical order. |
| Application to nonlinear model | 15% | Simulation of the chosen model with step-doubling error estimate and a claim-support statement. |
| Stiffness diagnosis | 15% | A stiff example. Demonstration of the stability limit. Discussion of the practical consequences. |
| Technical report | 10% | Three to five pages: model statement, implementations, convergence evidence, stiffness discussion. |
§ Milestones
- Choose the model and analytical reference Pick one of the suggested models or propose your own. Two hours.
- Implement the four solvers Euler, modified Euler, midpoint, RK4. One function per method. Three hours.
- Verify against analytical solution Run each method at one step size, compare to the exact solution. Two hours.
- Convergence study Run each method at four step sizes, compute observed order. Three hours.
- Apply to the nonlinear model Run with step doubling and report estimated error. Two hours.
- Diagnose stiffness Construct a stiff example, demonstrate the stability limit. Two hours.
§ Rubric
| Criterion | Excellent | Satisfactory | Needs work |
|---|---|---|---|
| Solver correctness | All four methods correct and verified. | Three methods correct; one has a minor error. | Two or more methods incorrect. |
| Convergence study | Observed order within 10% of theoretical for all methods. | Observed order within 25% for all methods. | Observed order does not match theory. |
| Application | Full simulation with error estimate and clear claim-support statement. | Simulation with error estimate but limited interpretation. | Simulation without error estimate. |
| Stiffness | Clear demonstration of the stability limit; practical implications discussed. | Demonstration of the stability limit without discussion. | No stiffness example. |
| Report | Well-organised, complete, self-contained. | Complete but disorganised. | Missing sections or unclear. |
§ Common pitfalls
Watch for these
-
Using
k₁in thek₃stage of RK4. The most common implementation error.k₃usesk₂. - Estimating order from only two step sizes. Two points can always be fitted by a line. Use at least four.
- Comparing the observed order to a single-point error. The order is the slope of the log-log plot, not a single ratio.
- Extrapolating a stiff step size from the stable regime. The stability limit is a hard boundary, not a soft one.
- Claiming the model is correct because the convergence order matches. Convergence order addresses the method, not the model.
§ Submission
What to submit
- A single ZIP archive named
M2-capstone-yourid.zip. - The archive contains the solver spreadsheet or code, the verification and convergence tables, the log-log plot, the stiffness demonstration, and the technical report.
- Submit through the course LMS before the deadline listed on the course schedule.