Trapezoidal Method

Description

The trapeziodal method is an implicit method for approximating the solution of the initial value problem y' = f(x,y); y(x0) = y0 at x for a given step size h. The trapezoidal method can be derived by expanding y(x) in a Taylor series
y(x+h) = y(x) + h y'(x) + (h2/2) y''(x) + O(h3)
and then subsituting (y'(x+h) - y(x))/h for y''(x) followed by substituting f(x,y) for y'(x). The approximation for y(x+h) is then given implicitly by
y(x+h) = y(x) + (h / 2) (f(x,y(x)) + f(x+h,y(x+h))).
or
y(x+h) - (h / 2) f(x+h,y(x+h)) = y(x) + (h / 2) f(x,y(x)).
.In order to use the trapezoidal method, the user must program a function g whose value is that value of y such that
y(x+h) - h' f(x+h,y(x+h)) = u,
where h'=h / 2 and u = y(x) + h' f(x,y(x)), i.e.
g(x+h,h',u) - h' f(x+h,g(x+h,h',u)) = u.

Locally the trapezoidal method is a third order method and therefore globally a second order method.

The trapezoidal method is a stable and convergent method with region of absolute stability

| (2 + µh) / (2 - µh) | < 1
in the complex µh plane.

As a rule, the trapezoidal method is convenient if the function g(x,h,u) is simple.

Function List

C Source