ODE Step Solver (Euler and RK4)
Solve y' = f(x, y) step by step with Euler, improved Euler or Runge-Kutta 4.
How it works
Type y' as a formula in x and y, the start point, the step size h and where to stop. Pick Euler, improved Euler (Heun) or Runge-Kutta 4. The tool steps forward and shows a table.
The formula
Euler: y1 = y0 + h f(x0, y0) Heun: y1 = y0 + h/2 (k1 + k2) RK4: y1 = y0 + h/6 (k1 + 2 k2 + 2 k3 + k4)
Worked example
For y' = y with y(0) = 1, RK4 with h = 0.1 gives y(1) = 2.71828, very close to e. Euler gives 2.59374.
Good to know
- Halving h cuts the Euler error about in half and the RK4 error about 16 times.
- A negative h with a smaller stop x solves backwards.
- If values blow up, try a smaller h.
Common questions
- Which method should I use?
- RK4 for accuracy. Euler to learn the idea.
- Why must the range be a whole number of steps?
- So the last step lands exactly on the stop x.
- Can it solve second-order equations?
- Not directly. Rewrite as two first-order equations.
More in Math, Science & Engineering.
Scientific Calculator with Steps
Type a whole expression and see the answer with each step in the order it was worked out.
OPEN →Matrix SolverDeterminant, inverse, rank, transpose, products and linear systems for small matrices.
OPEN →Laplace Transform TableStandard Laplace pairs and properties. Type part of a function like sin or e^ to filter.
OPEN →