Trapezoidal rule (differential equations)

From HandWiki
Revision as of 06:21, 27 June 2023 by SpringEdit (talk | contribs) (update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Numerical method for solving ordinary differential equations

In numerical analysis and scientific computing, the trapezoidal rule is a numerical method to solve ordinary differential equations derived from the trapezoidal rule for computing integrals. The trapezoidal rule is an implicit second-order method, which can be considered as both a Runge–Kutta method and a linear multistep method.

Method

Suppose that we want to solve the differential equation [math]\displaystyle{ y' = f(t,y). }[/math] The trapezoidal rule is given by the formula [math]\displaystyle{ y_{n+1} = y_n + \tfrac 1 2 h \Big( f(t_n,y_n) + f(t_{n+1},y_{n+1}) \Big), }[/math] where [math]\displaystyle{ h = t_{n+1} - t_n }[/math] is the step size.[1]

This is an implicit method: the value [math]\displaystyle{ y_{n+1} }[/math] appears on both sides of the equation, and to actually calculate it, we have to solve an equation which will usually be nonlinear. One possible method for solving this equation is Newton's method. We can use the Euler method to get a fairly good estimate for the solution, which can be used as the initial guess of Newton's method.[2] Cutting short, using only the guess from Eulers method is equivalent to performing Heun's method.

Motivation

Integrating the differential equation from [math]\displaystyle{ t_n }[/math] to [math]\displaystyle{ t_{n+1} }[/math], we find that [math]\displaystyle{ y(t_{n+1}) - y(t_n) = \int_{t_n}^{t_{n+1}} f(t,y(t)) \,\mathrm{d}t. }[/math] The trapezoidal rule states that the integral on the right-hand side can be approximated as [math]\displaystyle{ \int_{t_n}^{t_{n+1}} f(t,y(t)) \,\mathrm{d}t \approx \tfrac12 h \Big( f(t_n,y(t_n)) + f(t_{n+1},y(t_{n+1})) \Big). }[/math] Now combine both formulas and use that [math]\displaystyle{ y_n \approx y(t_n) }[/math] and [math]\displaystyle{ y_{n+1} \approx y(t_{n+1}) }[/math] to get the trapezoidal rule for solving ordinary differential equations.[3]

Error analysis

It follows from the error analysis of the trapezoidal rule for quadrature that the local truncation error [math]\displaystyle{ \tau_n }[/math] of the trapezoidal rule for solving differential equations can be bounded as: [math]\displaystyle{ |\tau_n| \le \tfrac1{12} h^3 \max_t |y'''(t)|. }[/math] Thus, the trapezoidal rule is a second-order method.[citation needed] This result can be used to show that the global error is [math]\displaystyle{ O(h^2) }[/math] as the step size [math]\displaystyle{ h }[/math] tends to zero (see big O notation for the meaning of this).[4]

Stability

The pink region is the stability region for the trapezoidal method.

The region of absolute stability for the trapezoidal rule is [math]\displaystyle{ \{ z \in \mathbb{C} \mid \operatorname{Re}(z) \lt 0 \}. }[/math] This includes the left-half plane, so the trapezoidal rule is A-stable. The second Dahlquist barrier states that the trapezoidal rule is the most accurate amongst the A-stable linear multistep methods. More precisely, a linear multistep method that is A-stable has at most order two, and the error constant of a second-order A-stable linear multistep method cannot be better than the error constant of the trapezoidal rule.[5]

In fact, the region of absolute stability for the trapezoidal rule is precisely the left-half plane. This means that if the trapezoidal rule is applied to the linear test equation y' = λy, the numerical solution decays to zero if and only if the exact solution does.

Notes

References

See also