A mimimum of theory for FD (finite difference) methods

1  The problem

We consider here a special type of a two point boundary value problem: Find a function y of the real variable x which satisfies the ordinary differential equation
y" = f(x,y,y')    with f:[a,b]×R ×R R ,

and the boundary conditions
g1 (y(a),y(b),y'(a),y'(b)) = 0 g2 (y(a),y(b),y'(a),y'(b)) = 0.

Here f, g1 , g2 are given functions of 3 respectively 4 variables. The simplest model for the boundary conditions is clearly
y(a)=y(b)=0

which is also used in some of our examples. For general cases of f, g1 , g2 there exist no existence results, not to speak about uniqueness. Indeed in our examples there are two quite harmless looking cases which have two solutions and cases of nonsolvability can easily be constructed. Hence the situation here is quite different from the case of initial value problems.
We assume in the following that a solution exists which is also sufficiently often differentiable in the interior of ]a,b[, typically we will need four derivatives of y at least.

2  Solution by discretization

We now replace the continuous problem by one in finitely many unknowns by a technique known as discretization by finite differences:
Step 1:
We choose a grid of constant width xi =a+i·h for i=0,,N and h= b-a N . We write now
y"( xi )=f( xi , yi ,y 'i )

with the simplifying notation yi :=y( xi ), y 'i :=y'( xi ).
Step 2:
We replace the derivatives of y at xi by suitable derivatives of interpolation polynomials of some neighboring points ( xi-j , yi-j ),...,( xi+k , yi+k ). For reasons concerning the properties of the resulting system of equations the degree chosen usually is 1 or 2. For example with j=k=1
yi ' = yi+1 - yi-1 2h +O ( h2 ) yi " = yi+1 -2 yi + yi-1 h2 +O ( h2 )

Step 3:
Let yi h denote the approximation for y( xi ). We get, by neglecting the O -terms the following system defining it:
    yi+1 h -2 yi h + yi-1 h h2 -f( xi , yi h , yi+1 h - yi-1 h 2h )=0,   1iN-1

Step 4:
The treatment of the boundary conditions. We first stick on the homogeneous conditions
y(a)=y(b)=0

resulting in
y0 h = yN h =0.

This leads to a system of N+1 coupled equations for the unknown approximations yi h for the values y( xi ). This system will be nonlinear if the function f is nonlinear in y or y'.
Example N=4, i.e. i=0,1,2,3,4:

i=1:    y2 h -2 y1 h + y0 h h2 = f ( x1 , y1 h , y2 h - y0 h 2h )    with y0 h =0 i=2:    y3 h -2 y2 h + y1 h h2 = f ( x2 , y2 h , y3 h - y1 h 2h ) i=3:    y4 h -2 y3 h + y2 h h2 = f ( x3 , y3 h , y4 h - y2 h 2h )    with y4 h =0

By directly using the known values at the boundaries there remains a system of equations for y h =( y1 h : y3 h ).
As usual in finite difference methods, the truncation error of this method is defined as the residual one obtains by inserting the true solution y(x) of the boundary value problem into the discretized system, for example in the case of discretizing y'(a),y'(b) by the onesided difference quotient as
τ(y;h)=( g1 (y( x0 ), y( x0 +h)-y( x0 ) h ,y( xN ), y( xN )-y( xN-1 ) h ) y( x2 )-2y( x1 )+y( x0 ) h2 -f( x1 ,y( x1 ), y( x2 )-y( x0 ) 2h )        y( xN )-2y( xN-1 )+y( xN-2 ) h2 -f( xN-1 ,y( xN-1 ), y( xN )-y( xN-1 ) 2h ) g2 (y( x0 ), y( x0 +h)-y( x0 ) h ,y( xN ), y( xN )-y( xN-1 ) h ) )

which is of order O ( h2 ) in the middle part and O (h) in the first and the last component. In case of the simple Dirichlet boundary conditions the first and the last component of this vector are zero of course.
For this special case considered here there exists an existence and uniqueness theorem, which however requires strong (sufficient) conditions
Theorem 1 Assume f C1 ([a,b]×R ×R ). Moreover assume that there holds

| s f(x,r,s)|B

for all x[a,b],r,sR and that
0 r f(x,r,s)

for all x[a,b], r,sR .
Then the boundary value problem with homogeneous Dirichlet boundary conditions is uniquely solvable. The discretized system is also uniquely solvable if
0<hmin { 2 (B+4 )2 ,b-a }.

If f is linear in y and y' then hmin { 2 B ,b-a } suffices for this. The discretized solution y h satisfies
   |y( xi )- yi h |C· h2

for some constant C (i.e. the method has convergence order 2).
If in addition f C2m+2 ([a,b]×R ×R ), then there holds more precisely with some smooth functions ei (x):
    yi h =y( xi )+ e1 ( xi ) h2 ++ em ( xi ) h2m +O ( h2m+2 ).

The last assertion in this theorem says that the global error
y(x)- yh (x)

behaves itself like a smooth function of x ( h fixed). Now imagine to compute such a discretized solution on grids with size h,h/2,h/4, These grids are coherent and on the crudest grid you win several approximate values of increasing precision. And obviously
y ~ i h = def 4 yi h/2 - yi h 3 =y( xi )- 1 4 e2 ( xi ) h4 +O ( h6 )

and finally
16 y ~ i h/2 - y ~ i h 15 =y( xi )+O ( h6 ).

Obviously this technique is the same as used in Romberg's method of quadrature and can be continued to get even higher order of convergence. This is a special case of Richardson's extrapolation to the limit. We use it here for the two stages shown above.
Next we have to discuss the case of general boundary conditions. The simplest idea is to discretize here the derivatives by the ordinary difference quotient of first order, getting the two additional equations necessary to fix (locally) the solution.
g1 ( y0 h , y1 h - y0 h h , yN h , yN h - yN-1 h h ) = 0 g2 ( y0 h , y1 h - y0 h h , yN h , yN h - yN-1 h h ) = 0

This destroys the convergence of second order, leaving a method of order one only. Also, the error expansion in powers of h now contains odd powers, requiring a different and less efficient Richardson extrapolation, since
y( x1 )-y( x0 ) h =y'( x0 )+ 1 2 hy"(ξ)

and similar at the right boundary. There are some tricks to overcome this effect, but they require that the differential equation maintains validity also a bit outside [a,b]. That means that the solution can be continued over [a-ε,b+ε] for some ε>0. In this case one introduces for example fictitious nodes x-1 =a-h and xN+1 =b+h and replaces
y'(a) by y1 h - y-1 h 2h y'(b) by yN+1 h - yN-1 h 2h

maintaining the development of the global error in even powers of h . Since one has now two unknowns in addition, one uses the discretized differential equation also for x=a and x=b in order to get two additonal equations for them.

3  Solution of the (non)linear system for y h

We consider the simple case
y(a)=y(b)=0

first. Of course in this case
y0 h = yN h =0

too and it remains a system for the unknown values at the N-1 interior nodes. The Jacobian of this system then has the tridiagonal form
1 h2 (0,,0,1,-2,1,0,,0)-(0,,0, ( s f ) (- 1 2h ), ( r f )·1, ( s f ) ( 1 2h ),0,,0) = 1 h2 (0,,0,1+ h 2 · ( s f ),-2- h2 · ( r f ),1- h 2 · ( s f ),0,,0).

The conditions of the above theorem then result in the fact that this Jacobian is always invertible and has a condition number of the order of magnitude of h-2 . Since the influences of the rounding errors in the computed y h will be in the order of machine precision times condition number and the global discretization error is in the order Ch2 with C=max{| e1 (x):x[a,b]} it makes little sense to reduce h below the fourth root of the machine precision. Under the strong assumptions of the theorem the solution of the discretized system is globally unique (Hadamards theorem applies) and the damped Newton method will converge from every starting point, but as usual the quadratic convergence will become apparent for good initial guesses only. And one must be aware that the restrictive assumptions of the theorem will usually not apply. At best they will be satisfied in a strip around the true solution and anything will work if the initial guess is in inside this strip.
If boundary conditions must also be discretized, then two rows and columns will be added on top and bottom of this matrix. It will maintain the tridiagonal structure if the first order approximation of the derivatives at the boundary are used, otherwise a quindiagonal structure is added there. Anyway the solution of the linearized system within Newton's method will be simple and efficient.



File translated from TEX by TTM Unregistered, version 4.03.
On 20 Jun 2016, 18:29.