Type a command or search the notes. Tab cycles completions. Up and down recall history when blank. Escape dismisses, then leaves the prompt.
MATH
[1251]

Methods from Numerical solutions

All methods from Numerical solutions.

Back to Numerical solutions

Euler's method

For the IVP

y′=f(x,y),y(x0)=y0,y'=f(x,y),\qquad y(x_0)=y_0,

choose a step size hh and define

xk+1=xk+h,yk+1=yk+hf(xk,yk).x_{k+1}=x_k+h, \qquad y_{k+1}=y_k+h f(x_k,y_k).

The update uses the tangent line at the left endpoint of each step.

The formula uses the current slope over one short step: the tangent line through (xk,yk)(x_k,y_k) has value yk+hf(xk,yk)y_k+h f(x_k,y_k) at xk+hx_k+h. This is the degree-one Taylor model at the current point and Taylor's theorem describes the remainder omitted by one such step.

For an exact starting value yk=y(xk)y_k=y(x_k), the fundamental theorem of calculus gives

y(xk+h)=yk+∫xkxk+hy′(s) ds.y(x_k+h)=y_k+\int_{x_k}^{x_k+h}y'(s)\,ds.

Euler replaces the changing slope inside this integral by y′(xk)y'(x_k). If ∣y′′∣≤M|y''|\le M on the step, then ∣y′(s)−y′(xk)∣≤M∣s−xk∣|y'(s)-y'(x_k)|\le M|s-x_k|, so this local error is at most Mh2/2Mh^2/2.

In an actual computation yky_k is already approximate, so errors also propagate from previous steps. If the slope field changes at most proportionally with yy (the Lipschitz condition) and the solution is smooth on a fixed interval, standard stability estimates bound the largest accumulated error by a constant times hh as hh tends to zero. Thus, for a sufficiently small step size and a fixed interval, halving hh roughly halves Euler's global error. This numerical stability concerns error propagation in the method, not whether solutions of the ODE grow or decay.

Heun's method

Starting from (xk,yk)(x_k,y_k), first predict the next value with Euler:

uk+1=yk+hf(xk,yk).u_{k+1}=y_k+h f(x_k,y_k).

Then correct using the average of the slope at the current point and the predicted endpoint:

yk+1=yk+h2[f(xk,yk)+f(xk+1,uk+1)].y_{k+1} =y_k+\frac h2 \left[ f(x_k,y_k)+f(x_{k+1},u_{k+1}) \right].

Where Euler uses only the left-endpoint slope, Heun's method applies the trapezoidal rule to

y(xk+1)=y(xk)+∫xkxk+1f(x,y(x)) dx,y(x_{k+1})=y(x_k)+\int_{x_k}^{x_{k+1}}f(x,y(x))\,dx,

but the endpoint value is unknown, so the Euler prediction supplies it. Using both slopes makes Heun more accurate at the same step size.

When ff and the exact solution are sufficiently smooth and the usual Lipschitz and error-stability conditions hold on a fixed interval, Euler has local error O(h2)O(h^2) and global error O(h)O(h), whereas Heun has local error O(h3)O(h^3) and global error O(h2)O(h^2). Thus halving hh roughly quarters Heun's global error (until round-off or other errors dominate).

On this page