Improved Euler / Heun Method Calculator
Use the improved Euler, or Heun, method to solve a first-order initial-value problem. Heun predicts the end-of-step value with Euler and then averages the starting and predicted slopes.
Expression syntax: use explicit multiplication such as 2*y. Supported functions include sin, cos, tan, exp, ln, sqrt and abs.
How this tool works
Predict y* = yₙ + h f(xₙ,yₙ), then correct with yₙ₊₁ = yₙ + h[f(xₙ,yₙ)+f(xₙ+h,y*)]/2. The global error is second order for smooth problems.
Example
Use y′ = sin(x) − 0.5y and compare Heun with Euler at the same h. The corrected slope generally tracks curvature better without the four function evaluations used by RK4.
Common questions
Is Heun the same as improved Euler?
Yes in this calculator. The name commonly refers to the explicit trapezoidal predictor-corrector RK2 method.
How many slope evaluations are used per step?
Two: one at the start and one at the Euler-predicted endpoint.