Topic 15.1: Finite-Difference Method (HOWTO)

Contents Previous Chapter Start of Chapter Previous Topic Introduction Notes Theory HOWTO Examples Engineering Error Questions Matlab Maple Next Topic Next Chapter

Problem

Approximate the solution of the 2nd-order linear ordinary differential equation

c2(t) y(2)(t) + c1(t) y(1)(t) + c0(t) y(2)(t) = g(t)

subject to the boundary conditions

y(a) = ya
y(b) = yb

Assumptions

The functions ci(t) are appropriately continuous.

Tools

We will use the centred divided-difference formula for the derivative and linear algebra.

Process

Divide the interval [a, b] into n sub-intervals by defining h = (ba)/n, setting ti = a + ih for i = 0, 1, 2, ..., n. Let yi represent the approximation of y(ti), and therefore

y0 = ya
yn = yb

Rewrite the differential equation

as

We can simplify this by multiplying by 2h2 and collecting on the y's:

Evaluate this equation at each of the points i = 1, 2, ..., n − 1.

This defines a system of n − 1 linear equations and n − 1 unknowns. Thus, this can be written in the form My = g.

Special Case

In the special case where the coefficients are constant, that is, the differential equation is of the form:

c2 y(2)(t) + c1 y(1)(t) + c0 y(2)(t) = g

and therefore the ODE simplifies to

Now define:

l = 2c2hc1
d = 2h2c0 − 4c2
u = 2c2 + hc1
v = 2h2g

and solve the system of linear equations:

Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.