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·h2
Numerical value y_N0.1215766546
Steps N20
Step size h0.1
Derivative evaluations20 (1 per step)
Integration directionforward (h > 0)
Supplied reference at t_end0.1353352832
Absolute error vs supplied reference0.01375862865

The supplied reference agrees with the initial condition at t₀, so the differences below are reported as error relative to that reference.

Trajectory

Explicit Euler yₙy_ref(t) = exp(-t) (supplied reference)
y′ = -y from t₀ = 0 to t_end = 2 with h = 0.1. Every marker is a computed node; the straight segments between them are a reading aid, not computed values.

Trajectory nodes

Every computed node with the supplied reference at the same node time. A relative error is left undefined where the reference is exactly zero.
ntₙyₙy_ref(tₙ)|yₙ − y_ref|relative
00110.000e+00.000e+0
10.10.90.9048374184.837e-35.346e-3
20.20.810.81873075318.731e-31.066e-2
30.30.7290.74081822071.182e-21.595e-2
40.40.65610.6703200461.422e-22.121e-2
50.50.590490.60653065971.604e-22.645e-2
60.60.5314410.54881163611.737e-23.165e-2
70.70.47829690.49658530381.829e-23.683e-2
80.80.430467210.44932896411.886e-24.198e-2
90.90.3874204890.40656965971.915e-24.710e-2
1010.34867844010.36787944121.920e-25.219e-2
111.10.31381059610.33287108371.906e-25.726e-2
121.20.28242953650.30119421191.876e-26.230e-2
131.30.25418658280.2725317931.835e-26.731e-2
141.40.22876792450.24659696391.783e-27.230e-2
151.50.20589113210.22313016011.724e-27.726e-2
161.60.18530201890.2018965181.659e-28.219e-2
171.70.1667718170.18268352411.591e-28.710e-2
181.80.15009463530.16529888821.520e-29.198e-2
191.90.13508517180.14956861921.448e-29.683e-2
2020.12157665460.13533528321.376e-21.017e-1

Continue

Open in ODE Solver Lab

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.

Related tools