Euler's Method Calculator
Solve dy/dx = f(x, y) numerically with Euler's method or the improved Euler (Heun) method: enter the initial value, step size and number of steps to get every step in a table.
How it works
Euler: yₙ₊₁ = yₙ + h·f(xₙ, yₙ), xₙ₊₁ = xₙ + h · Improved Euler (Heun): ỹ = yₙ + h·f(xₙ, yₙ), yₙ₊₁ = yₙ + (h/2)[f(xₙ, yₙ) + f(xₙ₊₁, ỹ)]
Euler's method follows the tangent line: from the current point it moves a step h in x and uses the slope f(x, y) given by the differential equation to update y. Its global error is proportional to h, so halving the step roughly halves the error. The improved Euler (Heun) method averages the slope at the start and at a predicted end point, giving error proportional to h² for little extra work.
Worked example
For dy/dx = x + y with y(0) = 1, h = 0.1 and 10 steps: y₁ = 1 + 0.1 × 1 = 1.1, y₂ = 1.1 + 0.1 × 1.2 = 1.22, … and after 10 steps y(1) ≈ 3.187485. The exact solution y = 2eˣ − x − 1 gives y(1) = 3.436564, showing the first-order error of Euler's method at this step size.
Sources: Euler's method — Wikipedia · Direction Fields and Numerical Methods — OpenStax Calculus Volume 2, 4.2
Frequently asked questions
How accurate is Euler's method?
Its local error per step is about h² and its global error about h, so it is a first-order method. Halving h roughly halves the final error; the improved Euler method is second order.
How do I choose the step size?
Pick h so that n·h reaches the x you need (for example h = 0.1 and 10 steps to go from 0 to 1), then halve h and double n to see whether the answer changes.
Can I step backwards?
Yes. Enter a negative h to move to smaller x values from the initial condition.
Why does my solution blow up?
Stiff or fast-growing equations need small steps; with a large h Euler’s method can overshoot and become unstable. Reduce h.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.