Euler’s Method Calculator

  • Free
  • No sign-up
  • Works on phones
  • Shows the working
Physics & Applied#24

Euler's Method ODE Solver

Approximates \(y' = F(x, y)\) step by step, compared with RK4.

This Euler’s method calculator approximates the solution of a first-order initial value problem \( y' = F(x, y) \), \( y(x_0) = y_0 \). Type the right-hand side, the starting point, a step size and where you want to stop, and it returns the first rows of the step table, the Euler estimate at the endpoint, and a fourth-order Runge–Kutta (RK4) value for comparison.

It’s built for differential equations homework, checking a hand-made table, or seeing how much accuracy you lose with a large step. It’s free and needs no sign-up.

How to use the Euler’s method calculator

  1. Enter \( F(x, y) \) in the y’ = F(x, y) box, using x and y. Write powers with ^ (x^2), and use sin(), ln(), sqrt() and e^(x). Implicit multiplication works, so 2x y and x sin(y) are fine.
  2. Enter the initial condition as x₀ and y₀.
  3. Choose the step h (it must be positive) and the value Solve up to x where you want the estimate. The number of steps is \( (x_{\text{end}} - x_0)/h \), rounded to a whole number.
  4. Press Solve ODE. The table lists \( n \), \( x_n \), \( y_n \) and the slope \( F(x_n, y_n) \) for the first five steps, then the Euler value, the RK4 value and the difference between them.

How it works

Euler’s method follows the slope field in straight segments. At each point it evaluates the slope, walks a distance \( h \) along the tangent line, and repeats:

$$x_{n+1} = x_n + h$$

$$y_{n+1} = y_n + h\,F(x_n, y_n)$$

Each step is a linear approximation, the same tangent-line estimate the linear approximation calculator makes, so the error per step is about proportional to \( h^2 \), and over a fixed interval the total error is roughly proportional to \( h \). The RK4 column uses four slope samples per step and is far more accurate at the same \( h \), which makes it a useful reference when no exact solution is available. If your equation is simply \( y' = ky \), you don’t need a numerical method: the exponential growth calculator gives the exact solution.

Worked example

Estimate \( y(1) \) for \( y' = y - x^2 \), \( y(0) = 1 \), with \( h = 0.2 \). That’s \( (1 - 0)/0.2 = 5 \) steps. You can type these same values into the calculator above.

\( n \) \( x_n \) \( y_n \) slope \( y_n - x_n^2 \)
0 0.0 1 1
1 0.2 1.2 1.16
2 0.4 1.432 1.272
3 0.6 1.6864 1.3264
4 0.8 1.95168 1.31168

For instance, the second step is \( y_2 = 1.2 + 0.2(1.2 - 0.04) = 1.432 \). The last step gives

$$y_5 = 1.95168 + 0.2(1.31168) = 2.214016$$

This equation happens to have an exact solution, \( y = x^2 + 2x + 2 - e^x \), which satisfies \( y(0) = 1 \). So \( y(1) = 5 - e \approx 2.28172 \), and the Euler estimate is low by about \( 0.0677 \). The RK4 row agrees with the exact value to four decimal places.

Now change \( h \) to 0.1, 0.05 and 0.01 in the calculator. Each time you halve the step, the Euler error roughly halves too. That’s what “first-order method” means in practice.

Reading the output (and when to distrust it)

  • Difference between Euler and RK4. Treat it as a rough error estimate for the Euler value. If it’s large compared with the answer, shrink \( h \).
  • Consistent undershoot or overshoot. When the solution curve is concave up, the tangent lines sit below it and Euler underestimates; when it’s concave down, Euler overestimates.
  • “The solution blows up” message. Some equations, such as \( y' = y^2 \), have solutions that shoot to infinity at a finite \( x \). No step size fixes that; the true solution doesn’t exist past that point.
  • Wild oscillations. For fast-decaying equations like \( y' = -40y \), a step that’s too large makes Euler’s values flip sign and grow. Reduce \( h \) until the output settles.
  • Too many steps. The tool caps the run at 200,000 steps, so a tiny \( h \) over a long interval needs a larger step.

For the method itself, with a full hand-worked table and the reasoning behind the error, read our guide to Euler’s method.

Related guides

Further reading

FAQ

Does the Euler’s method calculator show every step?

The table shows the first five steps in full, with \( x_n \), \( y_n \) and the slope at each one, then the final Euler estimate at your endpoint. For five steps or fewer, that’s the entire table.

What step size should I use for Euler’s method?

Start with whatever your problem specifies. If you’re choosing, keep halving \( h \) until the Euler value stops changing at the precision you need, or until it matches the RK4 row closely.

Why does the calculator also show RK4?

Runge–Kutta 4 uses four slope samples per step, and its error shrinks like \( h^4 \), so it’s a strong stand-in for the exact answer. The gap between the two tells you how far off the Euler estimate is.

Can I solve second-order equations with it?

Not directly. The tool handles a single first-order equation \( y' = F(x, y) \). A second-order equation has to be rewritten as a system of two first-order equations, which this calculator doesn’t accept.

Embed this calculator on your website

Teachers, tutors and bloggers are welcome to use this calculator for free. Copy the code below and paste it into any page (in WordPress, use a "Custom HTML" block). The small script makes the calculator grow to fit its answer; if your site removes scripts, it still works at a fixed height. Please keep the credit link.

More calculators

See all calculators