Euler's Method Calculator
Solve dy/dx = f(x, y) step by step with Euler’s method. A table and a graph compare it with Improved Euler (Heun) and RK4 against the exact solution. Two more tabs explore Euler’s formula, e^(iθ) = cos θ + i sin θ, and the number e.
How to Use
- On the Method tab, type the right-hand side of dy/dx = f(x, y), such as
x + y,-2*yory*(1-y), or pick a preset. - Set the starting point (x₀, y₀), the step size h and the number of steps (1 to 2,000).
- Optionally type the exact solution y(x), such as
exp(x), to see the error at the end and at every step. - Read the Euler, Heun and RK4 results at the last x and the graph of all three; Show Work writes out the first steps and has the full Euler table with the slope f(xₙ, yₙ) at each point.
- On the Formula tab, drag the angle to watch e^(iθ) move round the unit circle; on the Number e tab, raise n and the number of series terms to watch both approach e.
dy/dx = f(x, y)
eiθ = cos θ + i·sin θ
Approaching e ≈ 2.7182818…
Continuous compounding
Worked Example
y′ = y, y(0) = 1, h = 0.1, 10 steps (the default). The slope at (0, 1) is 1, so y₁ = 1 + 0.1 × 1 = 1.1; at (0.1, 1.1) it is 1.1, so y₂ = 1.21. Each step multiplies y by 1.1, and y(1) = 1.1¹⁰ = 2.593742. The exact solution eˣ gives 2.718282, so the Euler error is 0.1245. Heun reaches 2.714081 and RK4 2.71828 with the same 10 steps.
y′ = x + y, y(0) = 1, h = 0.1. The slope at (0, 1) is 1, so y₁ = 1.1; at (0.1, 1.1) it is 1.2, so y₂ = 1.1 + 0.12 = 1.22. After 10 steps Euler gives y(1) = 3.187485, against the exact 2e − 2 = 3.436564 from y = 2eˣ − x − 1.
The common mistake: too big a step on a decaying equation. For y′ = −2y each Euler step multiplies y by 1 − 2h. With h = 1.5 that factor is −2, so y goes −2, 4, −8, 16 at x = 6, while the true value e^(−12) is 0.000006. Euler only decays here when h < 1; the preset’s h = 0.1 gives 0.107374 at x = 1 against the exact 0.135335.
Show Work
Formulas
Three Ideas Named After Euler
Leonhard Euler described the step-by-step method in his Institutionum calculi integralis (1768–1770), as a way to approximate solutions that could not be found in closed form. Karl Heun published the improved two-slope version in 1900, and Carl Runge (1895) and Wilhelm Kutta (1901) developed the higher-order methods that led to RK4.
Jacob Bernoulli met the number e in 1683 while studying compound interest, and Euler’s use of the letter e appeared in print in his Mechanica (1736). Euler published the formula e^(ix) = cos x + i sin x in his Introductio in analysin infinitorum (1748).
About This Tool
This calculator runs Euler’s method, Heun’s method and RK4 side by side on the same equation, step size and number of steps, so the gain from each extra slope evaluation is plain to see; with an exact solution typed in, it also gives the error at every step. The Formula and Number e tabs cover the other two things that carry Euler’s name.
Everything runs in your browser; nothing is uploaded.
Related tools: Differential Equation Solver, Complex Numbers Calculator, and Exponential Growth Calculator.
Frequently Asked Questions
How does Euler’s method work?
It starts at a known point and repeatedly steps forward by h along the current slope: yₙ₊₁ = yₙ + h·f(xₙ, yₙ). For y′ = y with y(0) = 1 and h = 0.1, the first step is 1 + 0.1 × 1 = 1.1, every step multiplies y by 1.1, and after 10 steps y(1) = 1.1¹⁰ = 2.593742, against the true value e = 2.718282.
Why is my Euler answer off, and will a smaller step fix it?
Each step uses only the slope at its start, so the curve drifts away from the true solution. Euler is a first-order method: halving h roughly halves the error. For y′ = y at x = 1 the error is 0.1245 with h = 0.1, 0.0650 with h = 0.05 and 0.0135 with h = 0.01.
How much better are Heun and RK4?
Heun averages the slopes at the start and end of each step and its error falls like h²; RK4 combines four slopes and its error falls like h⁴. For y′ = y with h = 0.1, Heun gives 2.714081 (error 0.0042) and RK4 gives 2.718280 (error 0.0000021), against Euler’s 2.593742 (error 0.1245).
What can I type for f(x, y)?
x and y with + − * / ^ and brackets; the functions sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, sqrt, abs, sign, ln and log; and the constants pi and e. Note that log is base 10 and ln is the natural logarithm. Multiplication must be written out: 2*x, not 2x.
What do the Formula and Number e tabs show?
Euler’s formula, e^(iθ) = cos θ + i sin θ: at θ = 1.0472 rad (60°) it gives 0.5 + 0.86603i, and at θ = π it gives −1, so e^(iπ) + 1 = 0. The Number e tab shows (1 + 1/n)ⁿ = 2.71692393 at n = 1,000, the series 1/0! + 1/1! + … + 1/10! = 2.7182818011, and $1,000 at 5% for 10 years: $1,647.01 compounded monthly, $1,648.72 compounded continuously.
How do I use the Euler's Method Calculator?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Homework tables
The y′ = x + y preset gives y(1) = 3.187485 by Euler with h = 0.1, against the exact 2e − 2 = 3.436564.
Step-size studies
Halve h from 0.1 to 0.05 and watch the error at x = 1 fall from 0.1245 to 0.0650.
Stability
y′ = −2y with h = 1.5 swings to y = 16 after 4 steps, while the true value is 0.000006.
Complex numbers
See why e^(iθ) lies on the unit circle: θ = 60° gives 0.5 + 0.86603i.
Compound interest
$1,000 at 5% for 10 years is $1,648.72 with continuous compounding, $1.71 more than monthly.
Last updated: