Calculator · Engineering Mathematics
Euler Method Calculator
March a scalar first-order initial-value problem forward — or backward — with the explicit Euler method: one derivative evaluation per step, and a local error that is second order in h while the accumulated error is only first order.
Initial-value problem
Variables t and y. Operators + − * / ^, parentheses, pi and e, and sin, cos, tan, asin, acos, atan, exp, sqrt, abs, ln, log, log10. Write 2*y, not 2y.
A negative h integrates backward in time; h = 0 is rejected.
Whole number, 1 to 10,000. The interval is t₀ + N·h; the endpoint is derived, never entered.
A function of t only, e.g. exp(-t). Leave empty for no reference: nothing is then called an error.
The interval is defined by t₀, h and N. The end time is t₀ + N·h = 2: it is derived from the step contract, so no step is ever resized to reach a separately entered endpoint.
Result at the end time
| End time t_end = t₀ + N·h | 2 |
|---|---|
| Numerical value y_N | 0.1215766546 |
| Steps N | 20 |
| Step size h | 0.1 |
| Derivative evaluations | 20 (1 per step) |
| Integration direction | forward (h > 0) |
| Supplied reference at t_end | 0.1353352832 |
| Absolute error vs supplied reference | 0.01375862865 |
The supplied reference agrees with the initial condition at t₀, so the differences below are reported as error relative to that reference.
Trajectory
Trajectory nodes
| n | tₙ | yₙ | y_ref(tₙ) | |yₙ − y_ref| | relative |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0.000e+0 | 0.000e+0 |
| 1 | 0.1 | 0.9 | 0.904837418 | 4.837e-3 | 5.346e-3 |
| 2 | 0.2 | 0.81 | 0.8187307531 | 8.731e-3 | 1.066e-2 |
| 3 | 0.3 | 0.729 | 0.7408182207 | 1.182e-2 | 1.595e-2 |
| 4 | 0.4 | 0.6561 | 0.670320046 | 1.422e-2 | 2.121e-2 |
| 5 | 0.5 | 0.59049 | 0.6065306597 | 1.604e-2 | 2.645e-2 |
| 6 | 0.6 | 0.531441 | 0.5488116361 | 1.737e-2 | 3.165e-2 |
| 7 | 0.7 | 0.4782969 | 0.4965853038 | 1.829e-2 | 3.683e-2 |
| 8 | 0.8 | 0.43046721 | 0.4493289641 | 1.886e-2 | 4.198e-2 |
| 9 | 0.9 | 0.387420489 | 0.4065696597 | 1.915e-2 | 4.710e-2 |
| 10 | 1 | 0.3486784401 | 0.3678794412 | 1.920e-2 | 5.219e-2 |
| 11 | 1.1 | 0.3138105961 | 0.3328710837 | 1.906e-2 | 5.726e-2 |
| 12 | 1.2 | 0.2824295365 | 0.3011942119 | 1.876e-2 | 6.230e-2 |
| 13 | 1.3 | 0.2541865828 | 0.272531793 | 1.835e-2 | 6.731e-2 |
| 14 | 1.4 | 0.2287679245 | 0.2465969639 | 1.783e-2 | 7.230e-2 |
| 15 | 1.5 | 0.2058911321 | 0.2231301601 | 1.724e-2 | 7.726e-2 |
| 16 | 1.6 | 0.1853020189 | 0.201896518 | 1.659e-2 | 8.219e-2 |
| 17 | 1.7 | 0.166771817 | 0.1826835241 | 1.591e-2 | 8.710e-2 |
| 18 | 1.8 | 0.1500946353 | 0.1652988882 | 1.520e-2 | 9.198e-2 |
| 19 | 1.9 | 0.1350851718 | 0.1495686192 | 1.448e-2 | 9.683e-2 |
| 20 | 2 | 0.1215766546 | 0.1353352832 | 1.376e-2 | 1.017e-1 |
Continue
The problem, the step and the supplied reference continue into the Lab with Euler enabled. RK4 stays off there until you switch it on: this page never asked for it.
Assumptions & validity
- · The problem is a single scalar equation y′ = f(t, y) with one initial condition. Systems of equations are not solved here.
- · The step is FIXED: every node time is t₀ + n·h, computed from n rather than accumulated, so rounding never drifts the grid.
- · The end time is derived as t₀ + N·h. It is never entered separately and no step is resized to land on a target time.
- · f must return a finite value at every point the method visits; a non-finite derivative stops the march and is reported with its step.
- · The method is explicit and has a bounded region of absolute stability. For a strongly decaying problem, too large an h produces growing oscillation — a real property of the method at that step, not a bug.
- · A supplied reference is used for error only when it matches the initial condition at t₀. Otherwise it describes a different problem and no error is claimed against it.
- · Stiff problems are outside the scope of a fixed-step explicit method; nothing here detects or handles stiffness.
Technical reference
y′ = f(t, y), y(t₀) = y₀
tₙ = t₀ + n·h, n = 0 … N
yₙ₊₁ = yₙ + h · f(tₙ, yₙ)
Local truncation error: y(tₙ₊₁) − [y(tₙ) + h f(tₙ, y(tₙ))] = (h²/2) y″(ξ)
Global error at a fixed end time: O(h)
- h
- signed fixed step; negative integrates backward
- N
- number of steps taken
- yₙ
- numerical value at node time tₙ
- y(tₙ)
- the exact solution at the same time, generally unknown
- ξ
- an unspecified point inside the step
One derivative evaluation per step: N evaluations for N steps, the cheapest possible explicit method and also the least accurate per unit of work.
The local error of a single step is O(h²), but the errors of N ≈ T/h steps accumulate, so the error at a FIXED end time is O(h). Halving h roughly halves that error — and doubles the cost.
Observed first order in a refinement study is evidence consistent with the theory; it is never proof that a particular answer is accurate.
For the linear test problem y′ = λy with real λ < 0, Euler is stable only when |1 + hλ| ≤ 1. Beyond that step size the numerical solution grows while the exact one decays.
Backward integration (h < 0) is the same recurrence with a negative step; it is not an implicit or 'backward Euler' method, which this page does not implement.
Euler is the reference point against which higher-order methods are judged, and it remains useful where f is expensive and accuracy demands are modest.