You are on page 1of 10

INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING, VOL.

12, 1151-1 160 (1978)

IMPROVED FINITE DIFFERENCE FORMULAS FOR


BOUNDARY VALUE PROBLEMS
T. H. GAWAIN* AND R. E. BALL?

Department of Aeronautics, Naval Postgraduate School, Monterey, California, U.S.A.

SUMMARY
This paper deals with the numerical solution of linear differential equations of fourth order by finite
differences. It points out significant (but usually overlooked) errors which result from the conventional
method of imposing the boundary conditions in such problems. Revised finite difference formulas are
derived which apply near the boundaries and which eliminate the above errors.
Three commonly encountered boundary conditions are considered. These correspond, in the
terminology of beam analysis, to a clamped end, to a simply supported end and to a free end.
The improvement in accuracy that can be achieved with the revised formulas is illustrated by two
representative examples. The revised formulas are shown to reduce the overall error of the numerical
solution by a factor of about five in a typical case.

INTRODUCTION
This paper deals with the approximate numerical solution of ordinary differential equations of
fourth order by the method of finite differences. This well-known procedure is described in
many standard texts of which Reference 1 is a representative example. The reader is assumed
to be generally familiar with the technique.
The aim of this paper is to show briefly that the customary method of applying the boundary
conditions in such problems involves a significant but usually overlooked error, and to provide
revised boundary formulas which eliminate this error. A considerably more detailed analysis
of this same basic material may be found in Reference 2.
In this discussion 4(x) denotes the initially unknown function which is governed-by a known
linear differential equation of fourth order. Symbol D denotes the differential operator dldx.
We seek a numerical solution which satisfies the specified boundary conditions at x = 0 and
at x = I. Three common boundary conditions are considered and are labelled below according
to the terminology used in beam analysis, namely,
(1) Clamped end
4=0

D4=0

(1)

(2) Simply supported end

4=0
04 = O
(3) Freeend
D2q5 = 0

~~9= o
0029-5981/78/07 12- 1 15 1$01.00
@ 1978 by John Wiley & Sons, Ltd.

(3)
Received 1 February 1977
Revised 28 June 1977

1151

1152

T. H. GAWAIN AND R. E. BALL

Table I. Conventional finite difference formulas

Simply supported end

(1.9)
(1.10)

(1.11)

(1.12)

Free end
At station i = 1
1

D41=- [-+1+&+0]-~hZD3c$1+.. .
h

(1.13)

D2d1= 0

(1.14)

D34,= 0

(1.15)

D441
k-

h4

[241-442+243]-2D441+.

(1.16)

BOUNDARY VALUE PROBLEMS

1153

0-17)
(I. 18)
(1.19)
(1.20)

In the finite difference analysis, the function 4 is represented by its discrete values pi

(i = 1,2,3, . . . ,N) at uniformly spaced stations xi over the interval 0 s x s 1. Constant h


denotes the spacing between any two successive stations. In this paper we let index i = 1
denote the first station at which q5 is unknown and let index i = N denote the last station at
which 4 is unknown. Thus for a beam free at the left end, q1 denotes the unknown deflection
at XI = 0. For a beam clamped or simply supported at the left end, however, cpl denotes the
unknown deflection at the first station inboard of the end that is, at x l = h. Analogous
considerations apply to the quantity (PN at or adjacent to the right end. This convention
simplifies the indexing of the final finite difference equations so that they always run from i = 1
to i = N, inclusive.
To determine the unknowns &, 42,43.. . .+N, we rewrite the governing differential equation in finite difference form for the ith station, then require that the resulting equation be
satisfied for each of the stations i = 1,2,3, , . . ,N. This produces N simultaneous equations in
N unknowns which suffices to establish the required solution. The actual manipulations are
handled most expediently in matrix format.
Except for the stations at or immediately adjacent to the boundaries, the various derivatives
in the governing equation are usually approximated by the four conventional central difference
formulas summarized in Equations (I.lHI.4) of Table I. The term outside the brackets in each
equation represents the truncation error of the corresponding finite difference approximation.
Notice that all four of the conventional central difference formulas shown in Table I have
truncation error of order h2.
When reduced to matrix format, the governing differential equation has a band width equal
to the widest band of any derivative which appears in it. For a given order of truncation error,
the derivative of highest order requires the greatest band width. Thus for a truncation error of
order h2, the final calculation matrix has a band width of five.
The first four formulas in Table I may be applied routinely at interior stations, but special
problems arise near the boundaries. It suffices here to illustrate the problem for the left end.
Consider the case where the left end is either clamped or simply supported. Then at station
i = 1 immediately inboard of the end in question, the conventional central difference expressions for D& and D2& involve the three quantities q50, &, and &. The corresponding central
difference expressions for D3& and D441involve the five quantities &I,&,, &,42 and 43.
The quantities 41,& and 43 entail no problems. The quantity q50 vanishes for either a clamped
end or a simply supported end and therefore involves no difficulties. The problem that now
arises, however, is that the quantity &l lies outside the normal domain of integration 0 6 x s 1,

1154

T. H.GAWAIN AND R. E. BALL

and is in fact undefined. Thus D341 and D441 cannot be evaluated from the usual central
difference formulas until this difficulty be resolved.
A similar problem arises also if the left end be free. The details of this case may be found in
Reference 2.
It is apparent from considerations of symmetry that corresponding questions arise also at the
right end of the span.
Fortunately, there exists a generally accepted procedure for resolving these questions. The
rationale of this conventional solution, along with an indication of its limitations, is summarized in the next section. The results are in some respects surprising.
THE CONVENTIONAL BOUNDARY FORMULAS AND THEIR LIMITATIONS
The conventional solution for the left end clamped can be found by making the following
substitutions in equation 1.1 of Table I, namely,
i=O
40=0

(4)

Dc$o=O
The resulting relation can then be solved for &l as follows

4-1= 4+1- $ h 3 ~ 3 4 0 +...

(5 1
We can now evaluate Equations (I.lb(1.4) of Table I at station i = 1 making use of the
foregoing substitutions for doand c$-~. In this way we obtain the conventional finite difference
formulas for a clamped end as summarized in equations (1.5)-(1.8) of the table.
A similar process may be used for the simply supported end. The details may be found in
Reference 2. In this way we obtain the conventional finite difference formulas for a simply
supported end as summarized by equations (I.gk(1.12) of the table.
The corresponding conventional solution for the left end free is summarized in (1.13)-(1.20)
of the table. Notice that for a free end, special formulas are required not only at station i = 1
but also at station z = 2.
It is usually assumed that the conventional boundary formulas all have truncation errors of
order h2 because they are derived from central difference formulas having truncation errors of
order h2. Unfortunately, the results listed in Table I show that this is not always the case. An
important aim of this paper is to call attention to this common oversight.
Table I shows that some of the conventional boundary formulas have truncation errors of
order h, ho or even h-l! Such errors are excessive and are inconsistent with the order of error
involved in the rest of the calculation. They can be expected to increase the overall error of the
numerical solution. Sample calculations presented later in this paper confirm that this is indeed
the case. It will be shown that revision of these faulty expressions greatly reduces the overall
error of the final solution.
The method of making the needed revisions, and the results of these revisions, are summarized in the next section.

REVISED FINITE DIFFERENCE EQUATIONS OF CONSISTENT TRUNCATION


ERROR
Fortunately, the method of developing revised finite difference formulas where needed is
straightforward, if sometimes rather tedious. The function 4 in the vicinity of the end is

BOUNDARY VALUE PROBLEMS

1155

represented by a truncated power series. The form of the series must be such as to satisfy the
boundary conditions of interest as previously summarized in equations (l), (2) or (3). The
number of terms which must be retained in the series depends on the order of the derivative to
be estimated and on the desired truncation error of the estimate. The truncated series
expression is applied to a number of contiguous stations near the end of the beam. This yields a
set of simultaneous equations which can be solved for the initially unknown coefficients of the
series in terms of the quantities r$l, 42,c&, . . , . Once these coefficients are obtained in this
way, the desired derivative of q5 at the specified station may be readily determined from the
basic series expression. The result is the finite difference formula of interest.
By introducing an extra term into the series and retracing the original solution, the truncation error can readily be found.
The above process has been carried out for all of the conventional finite difference formulas
of Table I which involve excessive truncation errors. The revisions are always such as to render
all truncation errors consistently of order h 2 . The results of this revision are summarized in
Table 11. Notice that every formula in Table I whose error term is initially of order h2
reappears in Table I1 without change. Only the faulty formulas have been revised.
An interesting detail appears in equation (8) of Table 11. The truncation error term is seen to
involve h2 but the numerical coefficient happens to vanish in this case. Hence the true
truncation error degenerates to order h3 in this particular instance, which is exceptional.
It might be supposed that this circumstance would permit a reduction of band width here
but such is not the case for if the band width be reduced by one, the resulting truncation
error is found to be of order h not of order h2. Hence Equation (8) must be retained as
written.
It has been convenient to present the boundary formulas in Tables I and I1 specifically for
the left end of the span. The corresponding formulas for the right end can readily be inferred
from the foregoing results from considerations of symmetry. First we replace 41,42, 4 3 , and
cP4 by the corresponding quantities 4 ~q5N-l,
, c $ ~ - and
~
4 N - 3 respectively. In this connection
it is also convenient to reverse the order of corresponding terms from left to right so that the
terms still appear in order of increasing index. Secondly, we must reverse all signs for the
derivatives of odd order.
An important feature of Table I1 is that the boundary formulas for D44 at i = 1 involve not
only &, dZ and rP3 but also d4.This last term falls just outside the pentadiagonal format that
applies at the other stations. The corresponding formula for D44 at i = N likewise falls just
outside the pentadiagonal limit. Fortunately, it is a simple matter to transform the final
calculation matrix to a purely pentadiagonal form. This involves a straightforward auxiliary
calculation at i = 1 and another at i = N. These auxiliary calculations do not adversely affect
the truncation error of the final system of equations. Full details are given in Reference 2.

EXAMPLE: UNIFORMLY LOADED BEAM WITH CLAMPED ENDS


Two examples have been worked out to illustrate the improvement in accuracy that occurs
when the revised difference formulas of Table I1 are used in place of the conventional formulas
of Table I. In this section we consider a beam of uniform stiffness with clamped ends under a
uniform distributed load. In the next section we consider a beam of variable stiffness with
simply supported ends under a uniform distributed load.
For the uniform beam, the non-dimensional governing equation reduces to
D44 = 1

1156

T. H. GAWAIN AND R. E. BALL

Table 11. Finite difference formulas of consistent second order truncation error

(11.1)
(11.2)
(11.3)
(11.4)

Clamped end
1

D 4 L-[O+$&+0]-$h2D3&+.
'-h

..

(11.5)

1
D 2 4 ~ = i ; i [ - 2 ~ 1 + ~ Z + O ] - ~ h 2 D 4.~. l + .
1
D34 i?[-34,+O+$43]-&h2D540+.
'-h

(11.6)

..

1
D4&+--[16& -94,+f~$,-&~]+(O)h2D6#0+.
h4

(I1.7)*

..

(II.8)*

(11.9)
(11.10)
(11.11)*
(II.12)*

Free end
At station i = 1
(11.13)
(11.14)
(11.15)
(11.16)*

BOUNDARY VALUE PROBLEMS

1157

At station i = 2

D4 -I-1
$$+0+543+0]
,
-2h2D3&+.
..
-h

D342 - h-[[12+1
3
7

D44

-?& + ~ C #+J01,+&,h2D541
+ . ..

---[-B,$
1
+?24 -604 +-

Z-h4

17

01.17)

17

17

629

: % d ] - ~ hD A+...

(11.19)*

(II.20)*

* The asterisks denote those formulas of Table I1 which differ from the corresponding formulas of Table I.

and the boundary conditions for clamped ends are

4=0
a t x = O and x = l

(7)

D4=0
The exact analytical solution of these equations is simply
4e = 21 42(1-x)
~
Numerical solutions of this problem have been calculated firstly on the basis of the conventional finite difference formulas of Table I and secondly on the basis of the revised finite
difference formulas of Table 11. Results were calculated for three values of the important
dimensionless mesh size parameter h/Z, namely, values of 1/10, 1/20 and 1/40. The calculations were performed in double precision on an IBM 360/67 computer. Further details of
these calculations may be found in Reference 2.
As convenient measures of the overall relative error of the final numerical solution, the
following two parameters are used, namely,

and

In beam problems E expresses the maximum relative error in the calculated deflection while

S expresses the maximum relative error in the calculated curvature, and hence in the associated bending stresses.
Curves of E and S versus h / l are shown in Figure. 1.
The results confirm that error parameter E is greater for the conventional difference
formulas of Table I than for the revised formulas of Table 11. Indeed, in this particular
example, E happens to vanish identically for the revised formulas! Of course, such a complete
elimination of all truncation error is exceptional. It can only happen for those special cases,
like the present example, in which the true deflection curve happens to be a quartic. The curve
is a quartic for any uniform beam under uniform load, irrespective of the boundary conditions.

1158

T. H. GAWAIN AND R. E. BALL

10
RELATIVE ERROR E

60

n
2
U
v)

g 10-2
0

lx
u
w
W

RELATIVE ERROR

k-

per Tables I

-I

W
(L

lo3
f
1

0 1
h/l

-+

0.1

Figure 1. Errors of numerical solution for beam of uniform stiffness with clamped ends

By an interesting coincidence, the formulas of Tables I and I1 happen to give identical curves
of error parameter S versus h/l in this particular example. Inspection of the detailed solutions
reveals that the truncation errors represented by these two solutions happen in this particular
case to be equal in magnitude but opposite in sign!
EXAMPLE: BEAM OF VARIABLE STIFFNESS WITH SIMPLY SUPPORTED ENDS
In this section we consider a uniformly loaded beam of variable stiffness, simply supported
at both ends. Specifically,we choose a beam governed by the non-dimensional equation
D2(x3D2q5)= x3D495+ 6x2D3d+ 6xD24 = 1
over the range
1sxs2
The boundary conditions for simply supported ends are
a t x = 1 and x = 2
D2q5= 0

(1 1)

BOUNDARY VALUE PROBLEMS

1159

The exact solution for 4 is

The finite difference equations for this problem were set up according to the conventional
and revised formulas of Tables I and 11, respectively. Each of these cases was solved numerically for various values of the dimensionless mesh size parameter h/l. Each result was compared
with the corresponding exact analytical solution of equation (4) for the same value of h / l . The
relative error E , as defined by Equation (9), was calculated for each solution. The second error
function 6,as defined in equation (lo), was not calculated for the present example. Further
details of these calculations are given in Reference 2.
The calculated values of E were plotted against h/l. The results are summarized in Figure 2.
An interesting comparison of the results from the methods considered in this paper can be
made with the results of a study using the half-station method, as presented in Reference 3.

1iz

UI

111
0

fx

111

-I

10-

I-

J
W

111

-4

10

0.02 0.03 0.05

0.10

h/L

Figure 2. Errors of various approximations for beam of variable stiffness with simply supported ends

1 160

T. H.GAWAIN AND R. E. BALL

In the half-station method the finite difference approximations are made before expanding the
as opposed to the conventional or whole-station method, wherein
derivatives in D2(x3D24)
the finite difference approximation is made after D(x2D24) is totally expanded. It is
significant that the conventional finite difference approximation for the simply supported
boundary condition at each end of the beam was used in Reference 3. The relative error E , as
defined by equation (9), produced by the half-station method for this example was found to be

e = (0.4 X 10-2/0*4196X lo-) (h/1)

(15)
where the value 0.4 x lop2is obtained from Figure 3 of Reference 3 and 0.4196 X lo- is the
displacement of the beam at the centreline. This expression for E was verified by a numerical
solution of the half-station equations for several values of h / l . The error given by equation
(15) is plotted in Figure 2 as the line marked H.
Figure 2 permits some interesting and useful conclusions to be drawn. Like the previous
example, it again confirms that the conventional finite difference formulas of Table I give by
far the highest error. The revised formulas of Table I1 are seen to reduce the above error by a
factor of approximately five. Notice that the half-station method of Reference 3 involves an
error whose magnitude is intermediate between those associated with the formulas of Tables I
and 11.
SUMMARY OF RESULTS AND CONCLUSION
It has been shown that the conventional finite difference formulas for approximating the
derivatives of a function near a boundary have truncation errors of various orders, and that
some of these errors can become relatively large. Revised formulas are derived having
truncation errors all of which are consistently of second order. Two typical examples are
presented which show that the revised formulas reduce the solution error by a significant factor
(of the order of five or better) with negligible increase in the overall computational burden.
One of these cases is also solved by the so-called half-station method, and the resulting error
is found to be intermediate between those obtained by use of the conventional and revised
difference formulas.
It is concluded that the revised formulas presented in this paper are optimal for the solution
of differential equations by finite differences.
REFERENCES
1. S. H. Crandall, Engineering Analysis: A Survey of Numerical Procedures, McGraw-Hill, New York, 1956.
2. T. H. Gawain and R. E. Ball, Improved finite difference formulas for boundary value problems, Tech. Report
NPS67Gn77051A. Naval Postgraduate School, Monterey CA (1977).
3. N. J. Cyprus and R. E. Fulton, Finite difference accuracy in structural analysis,J. Struct. Diu. ASCE, 92,459471
(1966).