In
mathematics
Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
and
computational science
Computational science, also known as scientific computing, technical computing or scientific computation (SC), is a division of science, and more specifically the Computer Sciences, which uses advanced computing capabilities to understand and s ...
, Heun's method may refer to the improved or modified Euler's method (that is, the explicit trapezoidal rule), or a similar two-stage
Runge–Kutta method. It is named after
Karl Heun and is a
numerical procedure for solving
ordinary differential equation
In mathematics, an ordinary differential equation (ODE) is a differential equation (DE) dependent on only a single independent variable (mathematics), variable. As with any other DE, its unknown(s) consists of one (or more) Function (mathematic ...
s (ODEs) with a given
initial value
In multivariable calculus, an initial value problem (IVP) is an ordinary differential equation together with an initial condition which specifies the value of the unknown function at a given point in the domain. Modeling a system in physics or ...
. Both variants can be seen as extensions of the
Euler method
In mathematics and computational science, the Euler method (also called the forward Euler method) is a first-order numerical analysis, numerical procedure for solving ordinary differential equations (ODEs) with a given Initial value problem, in ...
into two-stage second-order Runge–Kutta methods.
The procedure for calculating the numerical solution to the initial value problem:
:
by way of Heun's method, is to first calculate the intermediate value
and then the final approximation
at the next integration point.
:
:
:
where
is the step size and
.
Description
Euler's method is used as the foundation for Heun's method. Euler's method uses the line tangent to the function at the beginning of the interval as an estimate of the slope of the function over the interval, assuming that if the step size is small, the error will be small. However, even when extremely small step sizes are used, over a large number of steps the error starts to accumulate and the estimate diverges from the actual functional value.
Where the solution curve is concave up, its tangent line will underestimate the vertical coordinate of the next point and vice versa for a concave down solution. The ideal prediction line would hit the curve at its next predicted point. In reality, there is no way to know whether the solution is concave-up or concave-down, and hence if the next predicted point will overestimate or underestimate its vertical value. The concavity of the curve cannot be guaranteed to remain consistent either and the prediction may overestimate and underestimate at different points in the domain of the solution.
Heun's Method addresses this problem by considering the interval spanned by the tangent line segment as a whole. Taking a concave-up example, the left tangent prediction line underestimates the slope of the curve for the entire width of the interval from the current point to the next predicted point. If the tangent line at the right end point is considered (which can be estimated using Euler's Method), it has the opposite problem.
The points along the tangent line of the left end point have vertical coordinates which all underestimate those that lie on the solution curve, including the right end point of the interval under consideration. The solution is to make the slope greater by some amount. Heun's Method considers the tangent lines to the solution curve at ''both'' ends of the interval, one which ''overestimates'', and one which ''underestimates'' the ideal vertical coordinates. A prediction line must be constructed based on the right end point tangent's slope alone, approximated using Euler's Method. If this slope is passed through the left end point of the interval, the result is evidently too steep to be used as an ideal prediction line and overestimates the ideal point. Therefore, the ideal point lies approximately halfway between the erroneous overestimation and underestimation, the average of the two slopes.
Euler's Method is used to roughly estimate the coordinates of the next point in the solution, and with this knowledge, the original estimate is re-predicted or ''corrected''. Assuming that the quantity
on the right hand side of the equation can be thought of as the slope of the solution sought at any point
, this can be combined with the Euler estimate of the next point to give the slope of the tangent line at the right end-point. Next the average of both slopes is used to find the corrected coordinates of the right end interval.
Derivation
:
:
:
Using the principle that the slope of a line equates to the rise/run, the coordinates at the end of the interval can be found using the following formula:
:
:
:
,
:
:
:
The accuracy of the Euler method improves only linearly with the step size is decreased, whereas the Heun Method improves accuracy quadratically
. The scheme can be compared with the
implicit trapezoidal method, but with
replaced by
in order to make it explicit.
is the result of one step of
Euler's method
In mathematics and computational science, the Euler method (also called the forward Euler method) is a first-order numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most basic explic ...
on the same initial value problem. So, Heun's method is a
predictor-corrector method with forward
Euler's method
In mathematics and computational science, the Euler method (also called the forward Euler method) is a first-order numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most basic explic ...
as predictor and
trapezoidal method as corrector.
Runge–Kutta method
The improved Euler's method is a two-stage
Runge–Kutta method, and can be written using the
Butcher tableau
A butcher is a person who may slaughter animals, dress their flesh, sell their meat, or participate within any combination of these three tasks. They may prepare standard cuts of meat and poultry for sale in retail or wholesale food establishme ...
(after
John C. Butcher):
The other method referred to as Heun's method (also known as Ralston's method) has the Butcher tableau:
[
.]
This method minimizes the truncation error.
References
{{Numerical integrators
Numerical differential equations
Runge–Kutta methods