Comparative numerical laboratory

ODE Time Stepping: Euler, Heun, RK4 — Chapter 10

Solve \(y'=-\lambda y,\ y(0)=1\) and compare accuracy and stability.

\[ y(t)=e^{-\lambda t}. \]

Methods compared

MethodConvenienceInconvenience / warning
EulerVery simple; useful for explanation.First order and stability-limited.
HeunSecond-order predictor-corrector idea.More evaluations per step.
RK4Very accurate for smooth nonstiff problems.More stages; still not ideal for stiffness.
Exact solutionBenchmark for this test.Not available for general IVPs.

Illustrative plot / animation

Numerical diagnostics

What the student must compare