Euler's Method Calculator

Enter a, b, the initial point, step size and step count to run Euler's method.

How it is calculated

The tool solves only the linear equation y′ = a·x + b·y, where you type the constants a and b. Starting from (x0, y0) it repeats yn+1 = yn + h × (a·xn + b·yn) and xn+1 = xn + h, where h is the step size and n the number of steps. The step size must be above zero, and n must be a whole number between 1 and 10,000; a decimal n such as 10.5 gives no result. For readability the table lists only steps 0, 1, 2 and the last step, with dots in between, followed by the final point. Values are shown to four decimals. The result is an approximation whose error grows with h and with the number of steps.

Worked example

Take y′ = x + y with a = 1, b = 1, starting at x = 0, y = 1, with h = 0.1 and 10 steps. Step 1: slope = 0 + 1 = 1, so y = 1 + 0.1 × 1 = 1.1 and x = 0.1. Step 2: slope = 0.1 + 1.1 = 1.2, so y = 1.1 + 0.12 = 1.22. Continuing to step 10 reaches x = 1.0000, y = 3.1875. The exact solution y = 2ex − x − 1 gives 3.4366 at x = 1, so Euler underestimates by about 0.25 with this step size.

Try this example →

Common mistakes

  • Using the tool for an equation of another form, such as y′ = x·y or y′ = y². Only the linear form a·x + b·y is supported, so a nonlinear right-hand side cannot be entered.
  • Entering the end value of x instead of the number of steps. If you want to reach x = 2 from 0 with h = 0.1, enter n = 20, not 2.
  • Choosing a step size that is too large. With a large h the curve can drift far from the exact solution, and with a negative b it can even oscillate or blow up; halve h and compare.
  • Expecting every step in the table. The tool prints only steps 0, 1, 2 and the last; run it again with a different n if you need an intermediate value.

Sources

About this calculator

Euler's method is the simplest numerical technique for approximating the solution of an ordinary differential equation when no closed-form solution is available or convenient. For a linear ODE y′ = a·x + b·y with a known starting point, it steps forward in small increments of size h using y_{n+1} = y_n + h·(a·x_n + b·y_n) — at each step, it just follows the tangent line given by the current derivative for one step's length, then recalculates the slope at the new point.

This calculator builds a step-by-step table (steps 0, 1, 2 and the last) so you can see how the approximation evolves, alongside the final estimated point. Euler's method has a local truncation error of O(h²) per step and a global error of O(h), meaning halving the step size roughly halves the total error — it's rarely used for high-precision work in practice (more accurate methods like Runge-Kutta 4 are preferred), but it remains the standard first algorithm taught in numerical analysis because it makes the core idea of numerical ODE solving — approximate the curve using its own slope, one small step at a time — completely transparent.

Was this helpful?

You can pick up to 3 reactions.

Note from the editors

Halving the step is the quickest accuracy test. For y′ = x + y from y(0) = 1, h = 0.1 over 10 steps ends at 3.1875 and h = 0.05 over 20 steps ends at 3.3066, so the two runs disagree and neither is final. A decay with b = −10 and h = 0.25 is worse: y goes to −1.5000, then 2.2500, and ends at 5.0625 after 4 steps, growing instead of dying out. Which equation are you stepping through?

Comments

  • Be the first to comment.

Popular calculators

All Calculators