Some simple examples of two-point linear boundary-value problems are:
(a)
y′′(x)+f(x)y′(x)+g(x)y(x)=r(x)(8.46)
with the boundary conditions
y(x0)=aandy(xn)=b(8.47)
(b)
yiv(x)=p(x)y(x)+q(x)(8.48)
with
y(x0)=y′(x0)=Aandy(xn)=y′(xn)=B.(8.49)
Problems of the type (b), which involve the fourth-order differential equation, are much involved and will not be discussed here. There exist many methods of solving second-order boundary-value problems of type (a). Of these, the finite difference method is a popular one and will be described in Section 8.10.1. Finally, in Sections 8.10.2 and 8.10.3 we discuss methods based on the application of cubic splines and weighted residuals.
8.10.1 Finite-difference Method
The finite-difference method for the solution of a two-point boundary value problem consists in replacing the derivatives occurring in the differential equation (and in the boundary conditions as well) by means of their finite-difference approximations and then solving the resulting linear system of equations by a standard procedure.
To obtain the appropriate finite-difference approximations to the derivatives, we proceed as follows.
Expanding y(x+h) in Taylor's series, we have
y(x+h)=y(x)+hy′(x)+2h2y′′(x)+6h3y′′′(x)+⋯(8.50)
from which we obtain
y′(x)=hy(x+h)−y(x)−2hy′′(x)−⋯
Thus we have
y′(x)=hy(x+h)−y(x)+O(h)(8.51)
which is the forward difference approximation for y′(x). Similarly, expansion of y(x−h) in Taylor's series gives
y(x−h)=y(x)−hy′(x)+2h2y′′(x)−6h3y′′′(x)+⋯(8.52)
from which we obtain
y′(x)=hy(x)−y(x−h)+O(h)(8.53)
which is the backward difference approximation for y′(x).
A central difference approximation for y′(x) can be obtained by subtracting Eq. (8.52) from Eq. (8.50). We thus have
y′(x)=2hy(x+h)−y(x−h)+O(h2).(8.54)
It is clear that Eq. (8.54) is a better approximation to y′(x) than either Eq. (8.51) or Eq. (8.53). Again, adding Eqs. (8.50) and (8.52), we get an approximation for y′′(x)y′′(x)=h2y(x−h)−2y(x)+y(x+h)+O(h2).(8.55)
In a similar manner, it is possible to derive finite-difference approximations to higher derivatives.
To solve the boundary-value problem defined by Eqs. (8.46) and (8.47), we divide the range [x0,xn] into n equal subintervals of width h so that
xi=x0+ih,i=1,2,…,n.
The corresponding values of y at these points are denoted by
y(xi)=yi=y(x0+ih),i=0,1,2,…,n.
From Eqs. (8.54) and (8.55), values of y′(x) and y′′(x) at the point x=xi can now be written as
yi′=2hyi+1−yi−1+O(h2)
and
yi′′=h2yi−1−2yi+yi+1+O(h2).
Satisfying the differential equation at the point x=xi, we get
yi′′+fiyi′+giyi=ri
Substituting the expressions for yi′ and yi′′, this gives
h2yi−1−2yi+yi+1+fi2hyi+1−yi−1+giyi=ri,i=1,2,…,n−1,
where yi=y(xi), gi=g(xi), etc.
Multiplying through by h2 and simplifying, we obtain
(1−2hfi)yi−1+(−2+gih2)yi+(1+2hfi)yi+1=rih2,i=1,2,…,n−1(8.56)
with
y0=aandyn=b(8.57)
Equation (8.56) with the conditions (8.57) comprise a tridiagonal system which can be solved by the method outlined in Section 7.5.9 of Chapter 7. The solution of this tridiagonal system constitutes an approximate solution of the boundary value problem defined by Eqs. (8.46) and (8.47).
To estimate the error in the numerical solution, we define the local truncation error, τ, by
τ=(h2yi−1−2yi+yi+1−yi′′)+fi(2hyi+1−yi−1−yi′).
Expanding yi−1 and yi+1 by Taylor's series and simplifying, the above gives
τ=12h2(yiiv+2fiyi′′′)+O(h4).(8.58)
Thus, the finite difference approximation defined by Eq. (8.56) has second-order accuracy for functions with continuous fourth derivatives on [x0,xn]. Further, it follows that τ→0 as h→0, implying that greater accuracy in the result can be achieved by using a smaller value of h. In such a case, of course, more computational effort would be required since the number of equations become larger.
An easier way to improve accuracy is to employ Richardson's deferred approach to the limit, assuming that the O(h2) error is proportional to h2. This means that the error has the form
y(xi)−yi=h2e(xi)+O(h4)(8.59)
For extrapolation to the limit, we solve Eq. (8.56) twice, with the interval lengths h and h/2 respectively. Let the corresponding solutions of Eq. (8.56) be denoted by yi(h) and yi(h/2). For a point xi common to both, we therefore have
y(xi)−yi(h)=h2e(xi)+O(h4)(8.60a)
and
y(xi)−yi(2h)=4h2e(xi)+O(h4)(8.60b)
from which we obtain
y(xi)=34yi(h/2)−yi(h).(8.61)
We have explained the method with simple boundary conditions (8.47) where the function values on the boundary are prescribed. In many applied problems, however, derivative boundary conditions may be prescribed, and this requires a modification of the procedures described above. The following examples illustrate the application of the finite-difference method.
8.10.2 Cubic Spline Method
We consider again the boundary-value problem defined by Eqs. (8.46) and (8.47). Let s(x) be the cubic spline approximating the function y(x) and let s′′(xi)=Mi. Then, at x=xi the differential equation given in Eq. (8.46) gives
Mi+fis′(xi)+giyi=ri(8.62)
But
s′(xi−)=3!h(2Mi+Mi−1)+h1(yi−yi−1)(8.63)
and
s′(xi+)=−3!h(2Mi+Mi+1)+h1(yi+1−yi)(8.64)
Substituting Eqs. (8.63) and (8.64) successively in Eq. (8.62), we obtain the equations
Mi+fi[6h(2Mi+Mi−1)+h1(yi−yi−1)]+giyi=ri(8.65)
and
Mi+fi[−6h(2Mi+Mi+1)+h1(yi+1−yi)]+giyi=ri.(8.66)
Since y0 and yn are known, Eqs. (8.65) and (8.66) constitute a system of 2n equations in 2n unknowns, viz., M0,M1,…,Mn,y1,y2,…,yn−1. It is, however, possible to eliminate the Mi and obtain a tridiagonal system for yi (see, Albasiny and Hoskins [1969]). The following examples illustrate the use of the spline method.
8.10.3 Galerkin's Method
This method, also called the weighted residual method, uses trial functions (or approximating functions) which satisfy the boundary conditions of the problem. The trial function is substituted in the given differential equation and the result is called the residual. The integral of the product of this residual and a weighted function, taken over the domain, is then set to zero which yields a system of equations for the unknown parameters in the trial functions.
Let the boundary value problem be defined by
y′′+p(x)y′+q(x)y=f(x),a<x<b(8.67)
with the boundary conditions
p0y(a)+q0y′(a)p1y(b)+q1y′(b)=r0=r1}(8.68)
Let the approximate solution be given by
t(x)=i=1∑nαiϕi(x),(8.69)
where ϕi(x) are called base functions. Substituting for t(x) in Eq. (8.67), we obtain a residual. Denoting this residual by R(t), we obtain
R(t)=t′′+p(x)t′+q(x)t−f(x)(8.70)
Usually the base functions ϕi(x) are chosen as weight functions. We, therefore, have
I=∫abϕi(x)R(t)dx=0,(8.71)
which yields a system of equations for the parameters αi. When αi are known, t(x) can be calculated from Eq. (8.69).