# Heun procedure

The Heun method , named after Karl Heun , is a simple method for the numerical solution of initial value problems . It is a one-step process and belongs to the class of the Runge-Kutta processes .

In contrast to the explicit Euler method , the approximation is made using a trapezoid and not a rectangle.

## Procedure

To the numerical solution of the initial value problem:

${\ displaystyle y '= f (t, y), \ quad \ quad y (t_ {0}) = y_ {0}}$ for an ordinary differential equation using Heun's method, choose a discretization step size , consider the discrete times ${\ displaystyle h> 0}$ ${\ displaystyle t_ {k + 1} = t_ {0} + kh, \ quad \ quad k = 0,1,2, \ dots}$ and calculate first analogously to the explicit Euler method

${\ displaystyle y_ {k + 1} ^ {[P]} = y_ {k} + hf (t_ {k}, y_ {k}) \ quad, \ quad k = 0,1,2, \ dots}$ and then

${\ displaystyle y_ {k + 1} = y_ {k} + {\ frac {1} {2}} h (f (t_ {k}, y_ {k}) + f (t_ {k + 1}, y_ {k + 1} ^ {[P]})) \ quad, \ quad k = 0,1,2, \ dots}$ what can be formed

${\ displaystyle y_ {k + 1} = {\ frac {1} {2}} y_ {k} + {\ frac {1} {2}} (y_ {k + 1} ^ {[P]} + hf (t_ {k + 1}, y_ {k + 1} ^ {[P]})) \ quad, \ quad k = 0,1,2, \ dots}$ The are the approximate values of the actual solution function at times . ${\ displaystyle y_ {k}}$ ${\ displaystyle y (t)}$ ${\ displaystyle t_ {k}}$ ${\ displaystyle h}$ is called the step size. If the step size is reduced, the procedural error becomes smaller (i.e., they are closer to the actual function value ). The global error of Heun's method is almost zero; one also speaks of the convergence order 2. ${\ displaystyle y_ {k}}$ ${\ displaystyle y (t_ {k})}$ ${\ displaystyle h ^ {2}}$ 