Professional Documents
Culture Documents
Ordinary DifferentialEquations
7.1 Introduction
Differentialequationsexpress relationships
betweenvariablesin termsof their deriva-
tives,in contrastto the algebraicequationscoveredin Chapters2 and 3 whereno
derivativesoccurred.The needto solvedifferentialequationsarisesin a greatmany
problemsof mathematical modelling,because physicallawsin engineering and scienc€
areoftenexpressed in termsof thederivativesof variablesratherthatjust the variables
themselves.
The solution to a differential equation can sometimes be arrived at by analytical
integration. For example, the simplest type of differential equation is of the form
dy
, : Jlx) (7.1)
ox
210
S O L U T I O N SO F O R D I N A R YD I F F E R E N T I AELO U A T I O N S 211
dY d2v
tion
wherewe usethe nota'- y'' : --77etc.
dx, t"
In the sameway
but
The third equation, 7.10,is purely algebraicand representsthe solution to the two
differential equations.
In general, to obtain a solution to an nth order ordinary differential equation such
as that given in eq.7.5, n additional piecesof information will be required.
The way in which this additional information is supplied greatly influences rhe
method of numerical solution. If all the information is given at the same value of the
independentvariable,suchas in eqs 7.8 and 7.9,the problem is termed an 'initial value
problem'. If the information is provided at different valuesof the independent variable,
such as in the secondorder systemgiven by eq.7.I l, the problem is termeda 'boundary
value problem':
y ," +, -.y 1 , | 6
'--y:-, 1 , ( l ) : I , y ' ( 1 . 5 ) :- I (7.1 )
x x - x -
wirhflxo):yo
fl:f{*, i, (7.r2)
frr+ r dV
yi*r:/i+J,, (7.rs)
*ot
or alternatively
new intesration-l
I o.valuel:
fY J ["tO .""]".-l* f-nur.ri.ut (7.16\
L L ofy J I pr ocess J
Equation 7.16 gives the general form for all numerical solution techniquesfor initial
value problems. In the previous chapter we integrated under a curve of y vs.
x to
compute an area, but in this chapter we will be integrating under a curve of (dy/dx) vs.
x to compute the change in y. Many of the methods of numerical integration described
in the previous chapter still apply. The main difference here is that the function to be
integrated may depend on both x and y; thus we will need to modify our methods
slightly to account for this.
There are two main approachesfor performing the integration required by eq. 7.15:
(a) one-step methods, which use information from only one preceding point,
( x i , y i ) t o e s t i m a t et h e n e x t p o i n t ( x , * r , , I i * r )
One-step methods are self-starting with only the initial condition, whereas
multi-step methods require severalconsecutivevalues of x and'y to get started. These
initial values can be provided by a one-stepmethod if not provided in the initial data.
We will conc€ntrate initially on the numerical solution of a single first order
equation- It will be shown subsequentlyin Section 7.3.1.6that this is not a limitation,
because a higher order equation can be broken down into systems of first order
equations which can be solved by the same methods.
One-step methods are so called, becauseinformation about one previous step only is
used to generate the solution at the next step. This makes the one-step methods
relatively simple to implement in a computer program. There are several one-step
methods of increasing complexity, and as is often the casein numerical methods, the
more work that has to be done at eachstep,the greater the accuracy.The trade-offto be
z t q C H A P T E R7
7.3,1.1Euler'smethod
The simplestone-stepmethodhaslimitedaccuracyand is certainlynot recommended.
However,it forms the basisfor all subsequent methods.The numericalintegrationof
eq.7.l5 is performedusingthe rectanglerule (seeSection6.2.2)wherethe derivativeis
'sampled'
at the initial condition.Given the differentialeouation
y':f(x, y) with y(xo;:yo (7.17)
Euler's method estimates the new value of y using the expression
It:lo*hf(xo,Io) (7.l 8)
where , h:Xr-Xo (7.re)
This is the simpleststatementof eq.7.16.The methodis then repeatedusingthe,new'
initial conditions(xr,y,) to estimatey2and so on. For a generalstepi, we get
li+t:li*hf(xi, y) (7.20)
where ft: x;., 1 - x, (7.2r)
Errorafter2 steps
_t
I
x2, f2)
G r a d i e n=t f ( x r , y r )
( x s ,f s )
Gradient= t ( x o , f 6 )
xo x1
Fig. 7.1 Euler'smethod(two steps)
S O L U T I O N SO F O R D I N A R YD I F F E R E N T I AELO U A T I O N S
E4ample7.1
Given
''
Y -l- rt
y':^ withl2):2,
x
Solution7.1
(a) Two stepswill be requiredlf h:0.25
-+: :
- 2+ 0.2s1'
/'l -l-'l\
)42.2s) | 2.s
\ L /
/2.2s
+z.s\:3.028
12.5)=2.5+0.25[ ) )5
''aJ
t
\ /
/ )'+l n!\l : z z
A 2 '. t ) - 2 + o . r (
\ 2 /
- 2.40s
A2.3) * o:(2!!2-1) : r.uro
\ - ' " /
2}!}9!) :
= z.sr++ o:(
s{2.4) r.r23
\ 2 . 3 I
216 C H A P T E R7
ilzs)- z.8zs
. o.t(Y#) : r oou
The exactsolutionis givenby y:x[l +ln(xl2)] hencey(2.5):3.058.
7.3.1.2ModinedEuler'smethod
where Ke is the change in y based on the slope at the beginning of the step, and K1
is the change in y based on the slope at the end of the step.
h
I
li ;
act solution
\___-
I
I
I
Gradient=f(xr,yo+Kol
(xo,/e) T
xo
Example7.2
Given
, x+v
wirh 12):2,
e.stimate
12.5) usingthe modifiedEuler method.Let h:0.25.
Solution7.2
/"1 t-'t\
I(o:0.2s{= ):0.500
\ 2 . /
x,- : o.zs(2'2!^
* : o.rx Step I
\ -'-"
))\
=2's)
I
\ /
)42.25):2+| (0.500
+0.528):2.514
2'2t
-1'='tto):
- : o.zr( 2
*o
. 2 s / o.
- -r29
-'
\
y{2.5): 2"'
514+ + (0.529+ 0.554): 3.056
(cf.exactsolution 3.058)
Exact solution
\_
Gradient
I go+
|h, vo* )x; \.. l-
I
K1
( x s ,f s )
_ 2
t-
!x^w
I
tun----4- ---+J
ln
xo
Example 7.3
x + v"
'v ' - x with v0l:2
Solution 7.3
/'l -t-'l\
I(o :0 .2 5 {# ) :o.so )
\ L /
I
I
/z.tzs+2.25\
--#l:o.stqt
K r:0 .2 5 (
/z.zs+z.sut\
Ko:0.25('#l:o.szgq
\ 4 . u J / II
" o): o.roru
*,' : o.rr(''t"=t^?'1
Step2
'2.J't5
\ /
:3.0573
,,Q.r): r.r, O7+ 0.5426 )
(cf.exactsolution3.058)
73.1.4 Runge-Kuttamethods
.Runge-Kutta' methodsrefer to a large family of one-stepmethodsfor numerical
solutionof initial valueproblems,and includethe Eulerand modifiedEuler methods'
'order' of a method
which are first and secondorder Runge-Kutta methods.The
indicatesthe highestpower of h includedin the equivalenttruncatedTaylor series
expansion.
The generalform of all Runge-Kuttamethodsfor advancingfromstep'i'to'i+ I'is
as follows:
.- I
/i* r :/i* I
j=o
wix,f'p"w, (7.31)
The simplicity and accuracy of this method make it the most popular of all one-step
methods lor numerical solution of linear or nonlinear first order differential equations.
Derivation of eqs 7.33 and7.34 is beyond the scopeof the presentwork, however.
Example7.4
Solution7.4
/'l- =
t-'l\- l : r
Ko:0.51
\ / /
/z.zs+z.s\
r(,:0.5[ )rs ,l:l.os6
\ -'-" /
/l 'tst- r srR\
K,:0.5(T
/) : r . o o z
K"- o.ses
'^5 ''-\
+ 3'062)
:,.,,,
)s I
/
t { 2 . 5 ) : 2 a ; u + 2 ( 1 . 0 5 61+. 0 6 2 )1+. l l 2 l
:3.058
(cf.exactsolutiori3.058)
PROGRAM P71
c
C PROGRAM 7.1 ONE-STEP METHODS (SINGLE EQUATION)
C
c ITYPE: 1 (EULERTS METHoD) ITYPE= 2 (MoDrFrED EULER's METHoD)
c ITYPE: 3 (MrD-PoINT RULE) ITYPE= 4 (4TH oRDER RUNGE-KUT1.A)
c
READ (5, *) ITYPE,NSTEPS,H
READ (5,*) X,Y
WRITE (6,*) (r*********** o N E - S T E P M E T H O D S* * * * * * * * * * r )
WRITE (6,*)
co To (L,2,3,4) ITYPE
1 I{RITE (6r*) (r************ E U L E R S M E T H O D S* * * * * * * * * * * r )
WRITE (6, *)
WRITE (6,*) (' X Y')
DOlOI*O,NSTEPS
wRrTE (6,1OO) X,Y
RKO = H*F(X,y)
X : X + H
1 O Y - Y + R K O
. GOTO50
2 WRITE (6,*) (r******* M O D I F I E D E U L E R SM E T H O D* * * * * * * * r )
WRITE (6, *)
wRrrE (6,*) (, X Y')
Do20I=o,NSTEPS
wRrTE (6,1OO) X,Y
RKO = H*F(X,Y)
RKl = H*F(X+H,Y+RKO)
X = X + H
20y= y+0.5* (RKO+RKI)
co To 50
3 WRITE (6, *) ( | *********** MID-POTNT RULE ************ |
)
WRITE (6, *)
WRITE (6, * ) (. X Y')
Do30I=O,NSTEPS
WRITE (6,r,OO) X,Y
RKO : H*F(X,y)
RK1 : H*F(X+O. 5*H, Y+O. S*RKO)
X : X + H
3 0 Y = Y + R K l -
GO TO 50
4 WRITE (6,*) (r******** 4 T H O R D E R R I J N G E - K U T T A* * * * * * * * r )
I{RITE (6,*)
WRITE (6;r) (r X Y')
Do 4V I = O,NSTEPS
\.. /WRITE (6,100) X,Y
' --____,-,-/ RKO = H*F(X,Y)
RK1 : H*F(X+O.5*H,Y+O. 5*RKO)
RK2 : H*F(X+O. 5*H,Y+0. 5*RK1)
RK3 = H*F(X+H,Y+RK2)
X : X + H
40 Y = Y + (RKO+2.*RK1+2.*RK2+RK3)/6.
50 CONTINUE
10o FoRMAT (2El3.5)
STOP
END
FUI.ICTIONF(X,Y)
c
C T H I S F U N C 1 T T O NP R O V I D E S T H E V A L U E O F F ( X , Y )
C AND WILL VARY FROM ONE PROBLE}4 TO THE NEXT
c
P = (Y+X) *'t2
RETURN
END
222 C H A P T E R7
H Step length
X Initial and updated value of x
Y Initial and updated value of y
RKO
RKl Intermediate values of hf(x, y)
RK2
RK3
One-stepmethod ITYPE
to be used 4
Number and size NSTEPS H
of steps 5 0.1
Initial valuesof X Y
x and y 0.0 1.0
Fig. 7.4(a) Data for Program7.1
h ***t*t***r*
********
X
{TH
oNE-STEP HETHODS i*********
Y \
.0000oE+oo .100008+0L
.100008+oo .112308+01 I
.2000oE+oo .13085E+01 I
.300008+oo .15958E+01 I
.4ooooE+oo .20649E+01 |
.500008+oo .29078E+01
t; Fig. 7.a(b) Resultsfrom Program7.1
,:,-(.*i)-,
leadingto an exactsolutionof )'(0.5):2.9082
7.3.1.5Accuracyof one-stepmctho^
\oting that the second derivative of y at xe in finite differenceform can be written (see
Section7.4.1)
Example7.5
224 C H A P T E R7
Solution7.5
UsingProgram7.1
5 stepsof h:0.1 gives1'(0.5):2.82541
10 stepsof ft:0.05 gives10.5):2.88442
The globalerror in this methodis proportionalto ft2,hence
I : C(0.I )2
y,,^"r-2.8254
-
y..u", 2.88402:C(0.05)'
whereC is a constantof proportionality.
Theseequationscan be solvedfor C to give
C:'1.81477
In order for the solutionto be accurateto five decimalplaces,the error must not be
greatJrthan 0.000005, hence
:7.81467h2
0.00000s
and li :0.0008
A final run of Program7'1 with 625stepsof h:0'0008 givesl0'5): 2'90822which is
accurateto five decimalplaces.
#:t(',,'*,#,':;Jl (7.38)
. dy . d 2 v. d'- 'y
y(xo):,qo,*.(xo): At, (xo): 42,... (xo): A^_, (7.3e)
dl d{
We now replace all terms (except x) on the right-hand side of eq. 7.38by simple
variables.i.e.
the n first order equations together with their initial condition can be written thus:
dYo
d:r' vo@dA
: o
dYt
t:r, vr6d:Ar
: : fl'411
dyn-,
ln-2{xo): A,-z
*t:1,-t
dy'-,
,t#:f(r, lo,lr,..-,-rn-r) yn-L(xo):An-r
Example 7.6
Solution7-6
dry
I-ety:ys, lz
*,:rr, 4rz:
then ff:r,
dYt
Y'
Yo@d:A
yr (xo): B
I
I
Standard form
E: I
d r ,: r " , _ r r , I
yz(xo): C I
dx
226 C H A P T E R7
first orderequations
7.3.1,7Solutionof simuitaneous
In general,a systemof n first order equationswill be of the form
dy,
i:0, 1,2,...,n (7.42)
a ; : / r ( t ' l o ,! r , - - - , l , - )
with n initial conditionsy,(xo): Ai, i:0, l, 2,. . . , n
Considerthe systemof two equationsgiven below
dy
z) J'txo) : _Yo
dx: J \x, Y,
(7.43)
dz
, :g(x, y,z) z(x6):zs
ox
lx,):y(x6)*K
(7.44)
z(xr):71*o'1*7
where the nature of K or L dependson the method being applied. The modified Euler
method leads to the expressions
K:Kr a n dL : L r (7.47)
where
K s : h f ( x 6 ,! o , z o )
L s : h g ( x 6 , y o ,z o )
(7.48)
Kt:hf (xo*Ih, yo*}Ko, zs+!Ls)
Lt :hg(xo+lh, yo+|Ko, zo+rLo\,
,, K o + 2 K t+ 2 K z + K 3 , L o * z L r + 2 L 2 +L 3
and (7.4e)
6 6
S O L U T I O NO EL
DIFFERENTIA
SFORDINARY O U A T I O N S 227
where
&xample7.7
Given the equationd2yldxz:x-/ with initial conditionsl0):l and dy/dx(0):0,
estimatey(0.5)using
(a) midpoint rule (lr:0.25)
(b) fourth order Runge-Kutta (ft:0.5)
Solution7.7
rlu
?:z
ox
r,(o):I
Az
7:x-y z(o):0
dx
:{il,.i^{!},
{;},.-
: o{;:},.-
{l},., {;},.
.Tl*}
{;}",,,:{l}
r ]
: t -o.12sJ
L
:{l}.o',{-l
{;}.,. lli-,} : <
f o.sorl
?
[ -o.2re
j
'T
228 C H A P T E R7
{'} :l'J.*u
:{'} *1[{^'}*rf*'}+2lK'}+ix'll
I'J.., Llt.l-'\r, t-'\r,I-lr. iJ
:|oJ* -o0 ]*rJ-o.rzs]*rJ-o.os+'|,
_Jrl,1[I " '\-o:uJ"f-o.rzz'll
oLl rl *'l -orzsJ i -ozorJJ
therefore
fy'l f o.sssl
1,1",:i-o.lszj
10.5)-0.8e8
Theexactsolutionin thiscaseisgivenby y : *. x - sinx + x, hence : 6.393.
f,(0.5)
I r ' : f t $ , l r , ! 2 , . . . ,! , ) y l i . ( x dA
: r
l z ' : f z $ , t r , ! 2 , . . . ,t ^ ) yz$i: Az
: :
J / " : f , ( x ,y - r , l z , - . - , t ^ ) y"(xo):A"
230 C H A P T E R7
X = X + H*.5
CALL FUNC(K1,Y,X)
43
Do 43 I = 1,N
Y ( I ) = Y 0( I ) + K 1( r ) * . 5 * H
C A L L F U N C( K 2 , Y , X )
I
DO 44 I = lrN
44 Y(I) = Yo(I) + K2(I)*H
X = X + H * . 5
CALL FUNC(K3,Y,X)
DO 45 I = 1rN
4s Y(I) = Yo(I) + (K0(I)1-2.* (K1(I)+K2(I))+K3(I))/6.*H
4O CONTINUE
5O CONTINUE
1Oo FoRMAT (10813.s)
2 0 0 F O R M A T ( ' X Y ( I ) , I = L , " I 2 )
STOP
END
S U B R O L T T I N EF T ' N C( F , Y , X )
F(1) = 3.*x*y(2)+4.
r (2) = x*y(1)-y(2) -exp(x)
RETIJRN
END
The samefour methods available in Program 7.1 can be used,and the choicc is left to the user
through the input parameter IryPE. The number of equations to be solved is read into the
v a r i a b l e N . T h e a c t u a l f o r m o tf h e e q u a t i o n s l ( x ,! t , 1 2 . . . y , ) f o r i : 1 , 2 , . . . n i s e v a l u a t e d b y
F'
l
subroutine ruNc which will be changed by the user from one problem to the ncxt. It is rcadily
seen that Program 7.1 is a special case of Program 7.2 with N:1.
With the exception of simple integer @unters, the variables can be summarised thus
t ITYPE Defines method to be used (see main program)
lr;
I
N
NSTEPS
H
X
Y
Number of equations
Number of steps
Step length
Initial and updated values of X
l-d array holding initial and updated values of depcndent variables
I F l-d array holding function values
I
l ill
i rc'I Working space for advancing the solution by one step
I x, I
Kr)
PARAMETERrestrictionMEQ >N.
To illustrate use of the program, tbe following problem is to be solved using the fourth order
Runge-Kutta method. Given that
dv
-1:3xz *4. v(0):4
dx
S O L U T I O N SO F O R D I N A R YD I F F E R E N T I A E
LOUATIONS 231
dz
-z-e" z(0):1
dx:xl
One-stepmethod ITYPE
to be used
Number of N
equations 2
Number and size NSTEPS H
of steps 5 0.1
hiitiat vatueof x X
0.0
Initial valuesof Y(I),I: I, N
dept'ndentvariables 4.0 1.0
Fig. 75(a) Data for Program 7.2
* ko
Io': lo-Yo
(7.s2)
(7.53)
It' :lrJt * kr
C H A P T E R7
0<0<l
(7.s4)
which for a single equation is an explicit formula for y, in terms of yo and the
functions I and ft. For systems of equations the denominator can become a matrix
'implicit'.
in which case the system is
Example7.8
Solution7.8
+0)+0.5(0.25)]
0 +0.25[0.5(0
i(0.25): 1-0.25(0.5X1)
:0.036
+ 0.25)+ 0.5(0.s)]
0.036+ 0.25[0.s(0.036
f \"'-' I -0.25(0.5X1)
:0.148
(cf.exactsolution0.149)
S O L U T I O N SO F O R D I N A R YD I F F E R E N T I AELO U A T T O N S 233
yo":moyo'*l6ys+k6
(7.58)
Ir":mtyr'*Irlt*kr (7.se)
We now obtain the following expressionsfor y1 and y, ' using0 to 'weight'the
derivativesat x6 and xr, hence
A value of 0:I remains the most logical choice as it givesequal weight to derivatives
at
each end of the step. It may also be noted from eq.7.63 that the method would fail for
0:0.
For a single secondorder equation,the fourth order Runge-Kutta method is
considerablymoreaccuratethan thetrapeziumrule with B: I described in thissection.
Howeverfor largeengineeringsystemsinvolving equationswith coupledderivatives,
the linear interpolationmethodsinvolving g are still frequentlyusedbecauseof their
simplicity.
73.2 Predictor--correctormethods
Predictor--corrector
methodsuseinformationfrom severalpreviousknown points to
computethenextasindicatedin Fig.7.6.A disadvantage of themethodsis that theyare
not self-starting
andmay oftenneeda one-stepmethodto generate a fewpointsin order
to get started.The attraction of the methodsis that more efficientuse is made of
existinginformation in order to advanceto the next step.This is in contrastto the
fourth order Runge-Kuttamethodwhereat eachstep,four functionevaluationsare
requiredwhich are neverusedagain.
234 C H A P T E R7
.f
-D++ h**h*
Xo x.1 xz x3
G i v e ny ' = ( x , y l
y (xsl= fo
Use 1-stepmethod
to get started
ls solution
hardly
changing?
7.3.2.1Euler-trapezoidal
method
Example7.9
Solution7.9
Predictor y{0.2)-| +0.2(2):1.4
Corrector y{0.2)-I +0.1[2+2(0.42+20.41f:1.488
y\0.2)-I +0.1[2+2(0.2)2
+2(1.488)]:1.506
10.2)::I +0.1[2+ + 2(1.506)]:1.509
?tr0.2)'
I +0.1[2+ 2(0.42
),(0.2)- 1.510
+ 2(1.509)]:
Although'convergence'hasbeen achieved,the result has not convergedon the exact
C H A P T E R7
7.3.2.2Milne's method
Simpson'srule (corrector)
h l
/,*,(t):I,- t + , [ / ( x r - , , y i - ) ) ' l 4 f ( x 6 y ) + f ( x 1 + 1 , y i + r ( o ) ) -Jn O h t y k ) ( O (7.70)
h
yt * r('\: I i - r + i lf $, - r, yi - ) * 4f (x1,y;)+ f (x;+1,yi + r(t)1 etc. (7.7
r)
J
t; H a t c h e d? r e a = f 1 * ,
i t t
SamPling
points
Fig. 7.8 Milne's predictor
S O L U T I O N SO F O R O I N A R YD I F F E R E N T T AELO U A T I O N S
as a corrector, is that errors generatedat one stage of the calculation may subsequently
grow in magnitude(seeSection7.3.4).For this reasonother-fourthorder
methods have
tended to be more popular.
A more stable fourth order method, in which errors do not tend to grow so fast is
based
on the Adams-Bashforthpredictor, together with an Adams-Moulton corrector,i.e.,
Adams*Bashforth predictor
h
yr+r(o):yi+ yi_)-9.f(xi_r, yi_:)l
f i l S s f { * , , y ; ) - 5 9 f ( x ; - r , . ' , i _ r +) 3 7 f ( x ; _ 2 ,
. 251
-_L rt
i 2 o ' t 6s,,t"11
Y \\' (7.72)
Adams-Moulton corrector
h
l, * r(tt: I i * ) ff (x,- r, I i _ ) - 5f (x,_r, yi_ r ) * l9f (x;, y,)+ 9f (x,*,, y,* r(o))l
l9
- .r^h' Yt"(1) g.lly
h
!,*r('t:li*)lI$,-z,li_)-5-f(r,_r,yi_r)* l 9 f ( x i , y ; ) + 9 f ( x , * , , y , * r ( r ) ) l( 7 . 7 4 )
etc.
The improvedstabilityis obtainedat a costof somewhatlargererror termsthan in
Milne's rnethod,although the dominant terms still indicate that the corrector is
considerablymore a@uratethan the predictor.
The Adams-Bashforthpredictor integratesunder the curve of y, vs. x between
limits of x, and x,* ,, usingsamplingpointsshiftedto theleft of the rangeof integration
as shown in Fig. 7.9.
Example7.10
Solution7.10
: | +T{ss(z)- ssl:2(o.42+
Predictor)40.2) 40.6655)l
+ 37l2(0.q2 I 40)l- 9l2(0.6)'+ 2(0.I 9I 8)l) : r.4941
+ 2(0.4
: | +T{12{0.4)'
Corrector il0.2) n) - 512(0.42+
+ Ko.qt 2(0.66s
s)l+ rs(2)
+ 4r.494r)l\ : r.497
+ 912(0.42 6
r(0.2;:1.4931 (2nditeration)
il0-2):1.4982 (3rditeration)
(cf.exactsolution 1.498)
and
- - # hty(")((2) (7.76)
.1,(x,*,) y,* r(t):
y ( x ,* r ) - y , * r ( t ) = - * ( Y , * , ( t ) - Y , * r ( o ) ) (7.80)
Equations 7.79 and 7.80indicate that the error in the first corrected value of y;* 1 is
proportional to the differencebetweenthe predicted and corrected values.Subsequent
applications of the corrector are thereforeonly of marginal value as they give no further
information on the error size. It is recommended that when using Program 7.3, the
tolerance is set to the required accuracy,and the step length reduced until convergence
is achievedin one iteration.
The ability to estimatethe error at each step of the solution pro€ss means that the
step length can be adjusted to give the desiredlevel of accuracy.If required, a program
could take account ofthe error, and adjust the stepsizeaccordingly. Ifthe error was too
big, one strategy would be to keep halving the step sizeuntil the accuracy criterion was
met. At a subsequentstageof the calculation, the previously obtained step length might
become excessivelysmall, in which caseit could be increasedsystematically.It should
be noted however, that if the step length is changed during the calculation, it will b€
necessaryto recall someone-stepstarting procedure in order to generateenough points
at the new step length for the predictor-corrector algorithm to proceed.
PROGRAM P73
c P R O G R A M7 . 3 P R E D I C T O R C O R R E C T O RH E T H O D U S I N G
4TH ORDER ADAHS/BASHFORTH/MOULTON
REALX(s),Y(5)
FUNCTIONF(X,Y)
S O L U T I O N SO F O R D I N A R YD I F F E R E N T T AELO U A T I O N S 24'l
F : X * X + Y * Y
RETURN
END
<TOL
*** ****** P R E D I C T O R C O R R E C P O RH E T H O D r * * * * * * * *
* * * * * * * * * * ADAf,lS/ BASHFORTH/HOIILTON ***********
******t*** I INITIAMLUE PROVIDED ****'r*****
*** RE}'{JNING 3 FROH 4TH ORDER RUNGE-KU:ITA ***
X Y E R R TTERATIONS
.00000E+oo .00000E+00
.500008-01 .41667E-O4
.1000oE+oo .333338-03
.1500oE+oo .11250E-02
.200008+oo .266598-02 -,36{21E-08 i
{x):Cre-'*Crs-roo' (7.81)
wherethe secondterm decaysvery muchmore rapidly than the first. Sucha systemof
equationis said to be 'stiff'and solutionsare unreliablewhen treatedby traditional
methods.Any steppingmethodusedto tacklesucha problemnumericallymust have
a step length small enough to accountfor the 'fastest-changing'component of the
solution,and this stepsizemustbemaintainedevenafterthe'fast'componenthasdied
out. As has beendiscussedpreviously,very small steplengthscan havedisadvantages
from efficiencyand accuracyconsideration.
Whensolvingdifferentialequationsby repetitivealgorithmswhereerrorsintroduced
at one stageare carried on into subsequentcalculations,the question arisesas to
whether these errors will propagate with increasedmagnitude or remain within
acceptablelimits.
An 'unstable'processin the context of numericalmethodsis one in which a small
perturbation introducedinto the calculationwill grow spontaneously.Severalsources
of instability' can occur.
One sourceof instability' can be in the differentialequationitself rather than the
numericalmethodbeing usedto solveit. For example,the secondorder equation
with
l,(0): I +e (7.83)
7.4 Boundaryvalueproblems
When we attempt to solve ordinary differential equations of second order or higher
with information provided at different values of the independent variable, we must
usually resort to different methods of solution from those described in the previous
section.
'time'
The initial value problems covered previously often involved as the
independent variable, and solution techniques required us to 'march'along in steps
until the required solution was reached.The domain of the solution in such casesis not
S O L U T I O N SO F O R D I N A R YD I F F E R E N T I AELO U A T I O N S 245
finite, because in principle we can step along indefinitely in either the positiye or
negativedirection.
Boundary value problems usuallyinvolve a domain of solution which is finite,and
we wish to find solutionsto the equationwithin that domain.The independentvariable
in such problems is usually a coordinate measuringdistancein space.A typical second
order boundary value problem might be of the form
(a) Techniques that replace the original differential equation by its finite difference
eouivalent.
(b) 'Shooting methods', which attempt to replace the boundary value problem by an
equivalent initial value problem.
(c) Methods of 'weighted residuals', where a trial solution satisfying the boundary
'guessed',
conditions is and certain parameters within that solution adjusted in
order to minimise errors.
*11 **11 h
lt.
, ,- - y i - y ' t - t
t t -
h
li+r-ft li-li-t
h h
h (7.e0)
Y i *t - 2 ! r * l i - r
It -
h2
(7.er)
which is a central difference formula" being symmetrical about x1.
Similarly a central difference formula for the third derivative at x; is given by
i - t - 2 Y " i * Y "t * t
t, , i " t. - l " - h z
Known
solution
y' = f (x, y, y' )
--!'!':-l:::-'!)::: - \
Known
solution\
-----t-,---/ )
I
A r r x 2 x 3 B
Fig. 7.12 Two-point boundaryproblem(n:4)
The differential equation is then written in finite difference form at each of the
internal points i:1,2,..., n - L If the differential equation is linear, this leads to n - I
s i m u l t a n e o u sl i n e a r e q u a t i o n s i n t h e u n k n o w n v a l u e s! t , 1 2 , . . . , ! , - r . The more
248 C H A P T E R7
Example 7.1I
Given y" :3x * 4y subject to boundary conditions },(0): 0, l,( 1): I , solve the equation
in the range 0(x( I by finite differencesusing ft:0.2.
Solution 7.11
Firstly we write the differential equation in finite differenceform. From Tables 5.2-5.4
we have a choice of formulae for the required second derivative. It is usual to use
the lowest order central differenceform, unless there is a particular reason to use the
less accuiate forward or backward difference forms. hence from eo.7.91.
I
y i ' = - ( y , _ ,- 2 y , * y , * r )
n-
I
, - 2 Y , * Y , *1 ) : 3 x 1+ 4 y ; .
or(1,-
The solution domain is split into five equal strips,eachof width h:0.2 as shown in Fig.
7.13.The finite differenceequation is then written at each of the grid points for which
a solution is required. Known boundary conditions are introduced at this stage,with
typical valuesas shown in Table 7.1.
These four equations in the four unknown values of lr, !2, y3 and lr can be solved
using one of the methods described in Chapter 2. A summary of the finite difference
v
1.0
f"=3x+4Y
y ( 0 ) =0 y ( 1 ) = 1
v
n=5
h=0.2
t l
| -- |
(0,0)
/cucr h'o
y"=f(x,y,y,)
Y(Al=fa Known1stderivative
1)z
r'(B)=r'a fs- /z
V^ =
2h
fs-2Yo+ Yt
t B - A
Known
solution
)
/
/
irt
; lI
,*l-,*l
l-,-+-,-+-,-+-
A x t x 2 B=xa
;
Fig. 7.14 Derivative boundary condition
(7.e7)
Example7.12
Given xzy"+2xy'-2y:x2
{ 1 ) : 1 , / ' ( 1 . 5 ) :- 1
solvefor y in the range 1(x( 1.5usingfinite differences.
S O L U T I O N SO F O R D I N A R YD I F F E R E N T I A L
EOUATIONS 251
Solution7.12
Let tr:0.1 and write the equationin finite differenceform using centraldifferences,
hence
'fr
xr2 ^ ..xt,
0 t., - 2yi t y,-1)+ f (ri* r - | i - r)- 2y,:x,'
Table73. Differencc
equations
in Example7.12
t ,, Finite differenceequations
1.1
ffi 0,-zt,+rt+|{(r,- t) -2y,
: r.t2
1.2
ffi r* -zt,+y,)+# 0,- r ) -2yz:r.z2
1.3
ffi lt,- zyr+yr)+H (y.- !) - Zyt:1.32
1.4
ffi {t, - zt,+y.)+*1(y,- r ) -2vt: r.42
1.5 - li -Zys:r.52
ffi {* -ztr+y.)+H(yu
vzy"+2xy'-2f = x2
),(1)=1,y'(t.5)=-1
hence
lo- l* |
0.2
The solution to thesesix linear equations,together with the exact solution given by
135 l4lx x2
'u : - _ - -', | . _
86x2 172 4
.)y'crect ho
1.0 1.0 1.0
1.1 0.7981 0-7000
t.2 0.4774 0.4791
1.3 0.2857 0.2902
1.4 0.t432 0.1487
1.5 0.0305 0.0379
1.6 -0.0584 - 0.0513
The finite differencesolutions given in this section have performed quite well with
F.
F
relatively few grid points. This will not always be the case,especiallyif quite sudden
changesin the derivatives occur within the solution domain. In caseswhere no exact
t"
t solution is available for comparison, it is recommended that the problem should be
I
solved using two or three different gradations of the solution domain. The sensitivity of
the solutions to the grid size parameter fi, will often indicate the accuracy of the
[' solution. From the user's point of view, ir should be made small enough to enable the
;i desired accuracy to be achieved,but no smaller than necessary,as this would lead to
excessivelylarge systems of banded equations.
7.4.2 Shootingmethods
In order to solve this problem in the range A<x<B as an initial value problem,
we need to make assumptionsabout the gradient at the initial point x:l-
Hence let z(A):y'(A):ao where a6 is a 'guess' as to the gradient at x:A.
Sometimes, Qs czn be estimated from graphical or physical interpretations of the
solution.
Knowing the initial conditions, we can solve for y and z by any one-stepmethod
using stepsof h, until the solution at x: B is reached.Let this 'solution'for y be given by
yo(x).
We now repeatthe procedureusing a differentinitial gradient,z(A):1/(A): st,
leadingto a new'solution'fory, namell yr&).
If yo(B):bo and y,(B):b, then providedbo*bt, the solutionto the boundary
value problem can be written as follows:
I
,pr1: ----:- l0 u - b r)yo(x)+ (bo- y')yl (x)l (7.101)
oo-Dr
PROGRAM P74
c
c PROGRAM 7.4 SHOOTING METHODS FOR LINEAR 2ND ORDER
c BOTJNDARY VALUE PROBLE!{S
c
c ALTER NEXT LINE TO CHANGE PROBLEM STZE
c
PARAMETER (l,tAx:2s)
c
REAL Y (2r,Yo(MAX),Y1 (MAX),Ys (MAX)
S U B R O U T I N E R I J N G 4( Y , X , H )
r
c USING THE 4TH OFDER RUNGE-KU:TTA UETHOD
c
R E I A Ly ( * ) , K 0 ( 2 ) , K 1 ( 2 ) , K 2 ( 2 ) , K 3 (2),y0(2)
CALL FtNC(KO,Y,X)
D O 2 I = L , 2
I; 2
Yo(I) = Y111
Y(r) = Yo(I) + Ko(I)*.s*H
X = X + H*.5
$'
h;
3
cAtL FUNC(K1,Y,X)
DO 3 I = 1,2
Y(I) = Yo(I) + K1(r)*.srH
CALL FUNC(K2,y,X)
DO 4 I = 1,2
4 Y(I) = Yo(I) + K2(I)*H
X : X + H*.5
CALL FUNC(K3,Y,X)
D O 5 I = 1 , 2
5 Y(I) = Yo(I) + (Ko(r)12.* (xl(I)+K2(I))+K3(I))/6.*H
RETIJRN
END
S U B R O U T I N E F T J N C ( F ,Y , X )
c
c THIS SUBROUTINE PROVIDES THE VALUES OF F(X,Y) FOR EACH
c EQUATION AND WIT.T. VARY FROH ONE PROBLW TO THE NEXT
c
REAL F(2),Y(2)
c
F(1) = Y12;
F(2) =3.*x+4.*Y(1)
RTURN
END
S O L U T I O N SO F O R O I N A R YD I F F E R E N T I A E
LOUATIONS
!':z ),(0):0
z':3x*4y z(0)=0
!':z ),(0):0
z':3x*4y z(0): 1
The initial gradientsinput as A0 and Al, correspondingto z(0),havearbitrarily beengiven the
values0 and I respectively.Input and output to the program are shown in Figs 7.16(a)and (b)
f"=3x+4x
y ( 0 ) =0
y(1],=1
0.5 1.0
Fig. 7.17 Intermediate and final solutions by shooting method
v"=t(y',y,x)
YIA)=le
Y(B)=fa
Y B - Y o )( a t - a o )
a ' = a "^ + (
(y.,-yo)
--------a
Requiredsolution
^ +- -u -o T - - ., ( y a - y o ) @ r - a o ) (7.103)
u -
lt-lo
whichgivesy{,8):y*.
258 CHAPTER7
v":f(v',v,x)
subjectto boundaryconditionsy{,A):y^and y(B):y". A scquence of initial valueproblemsare
solvedby systematically altcringtheinitial gradientuntil both boundaryconditionsaresatisfied.
Initially,the sccondordere.quation mustbc brokendown into two first ordercquations,i.e.
'
!':z
7': f(2, y, x)
PROGRAH P75
c
c PROGR,AH7.5 SHOOTTNG HETHODS FOR NONLINEAR 2ND ORDER
c BOT'NDARY VALUE PROBLE!{S
c
c ALTER NEXT LINE TO C}IANGE PROBLN,{ SIZE
PARAHETER (l{.AX=25)
h
t
f
r
READ (5, *) NSTEPS,H,XA,YA,XB,YB,AO,Al,TOL,ITS
WRITE (5,*) (r******** S H O O T I N G I . { E T H O D SF O R * r * * * * * * r r )
WRITE (6,*) ('r******* NONLINEAR BVPiS USING ********')
fl wRrTE (5,*) (r******** LINEAR INTERPOLATION r********')
I{RITE (6, *)
X = X A
&'
r;
Y(r1 = Y1
Y ( 2 1= s g
Yo(1) = Yn
D o 1 0 I : 2 , N S T E P S + 1
cAr,L RI'NG4 (Y,X,H)
I 10 Yo(I) = Y111
I B0 : YO(NSTEPS+1)
I X = X A
I Y(1) - YA
Y(2) = a1
Y1(1) = Y1
D O 2 0 I = 2 , N S T E P S + 1
C A I , L R I J N G 4( Y , X , H )
20 Y1(I) = Y11;
81 : Y1(NSTEPS+I)
rF ((B0-YB)* (81-YB).GT.o.) TrrEN
t{RrTE (5,*) ('rRY NgW GRADTENTS')
STOP
END IF
ITERS = O
30 I T E R S = f T E R S + 1
AS = AO + (YB-80)* (A1-AO)/ (81-Bo)
X = X A
Y(1) = Y1
SOLUTIONS OF ORDINARY DIFFERENTIAL EOUATIONS 259
Y(z; = 35
Ys(1) = Ya
D O 4 0 I = 2 , N S T E P S + 1
C A L L R { J N G 4( Y , X , H )
40 Ys(I) : Y(1)
BS : YS(NSTEPS+1)
rr ( (BS-YB) * (80-YB) .GT. o. ) THEN
A o = A S
D O 5 0 I = 2 , N S T E P S + 1
50 Yo(I) = v511;
B 0 = B S
ELSE
A 1 : A s
D O 6 0 I = 2 , N S T E P S + 1
60 Y1(I) = Ys(I)
81 =. BS
END IF
rF (ABS((BS-YB)/YB).GT.ToL .AND. IrERS.LT.rTs) Go To 30
WRITE (6,*) (' X Y' )
X = X A
' wRrrE (6,too) x,Ys(1)
D O T O I = 2 , N S T E P S + l -
X = X + H
70 WRrTE (5,100) X,YS(I)
!{RITE (6,*)
WRITE (6, *)'AFTER" ITERS,'ITERATIONS'
100 FoRMAT (10El3.s)
STOP
END
S U B R O U T I N E R U N G A( Y , X , H )
c
c ADVANCES TWO 1ST ORDER EQUATIONS
c USING THE 4TH ORDER RUNGE-KU:TTA HETHOD
c
REALY1*),KO(2),Xl (2),K2(2),K3(2),vo(2'
CALL FUNC(KO.Y,X)
DO 2 I = 1,?
Yo(r) - Y(r)
2 Y(I) = Yo(I) + Ko(I)*.s*H
x = x + H*.5
CALL FUNC(Kl,Y,X)
DO 3 I = 1,2
3 Y(I) = Yo(I) + K1(I)*.s*H
C A L L F U N C( K 2 , v , X ' )
DO 4 I = 1,2
4 Y(I) = Y0(I) + K2(I)*H
X =.X + H*.5
CALL FI,'NC(K3,Y,X)
DO 5 I = 1,2
s y(I) = Yo(I) + (Ko(I)42.* (Kl(I)+K2(I))+K3(I))/6.t'H
RETTJRN
END
F(1) = Y121
F(2) = -2*Y(2)**2/Y(7)
RETURN
END
260 C H A P T E R7
M A X > N S T E P S +1
The input dataareverysimilarto thoserequiredfor Program7.4excxptfor the convergence
toleranceTOL. Computationwill stop,and a solutionwill be written to the output channel
if the followingconditionis satisfied:
lv*-v"l
l--l<TOL
I la I
or alternativelyif a maximumof ITS iterationis reached.Clearly,if a very strict toleranceis
required,more iterationswill be needed.
With the exceptionof simpleintegercounters,the variablescan be summarisedas follows:
1(01trI
z(01:1
)'
S O L U T I O N SO F O R D I N A R YD I F F E R E N T I A E
LOUATIONS 261
t':z {0): I
a-2
z(0):3
I
The two initial gradients input as A0 and A1, corresponding to z(0), have arbitrarily been
given the values 1 and 3 respcctively.Input and output to the program are shown in Figs 7.19(a)
and (b) respectively.The convergedsolution was obtained after 5 iterations with a tolerance of
0.0001.A step length of ft:0.1 was used to obtain the solutions which agree well with the exact
solution given by
y:(7x+ 1)t/3.
x Y
. oooooE+oo . 1 0 0 0 0 8 + 0 1
.100008+00 .11932E+01
. 2 O 0 O O E + O O . 13 387E+01
- 3000oE+oo .1{5798+01
.40000E+00 .1560{E+01
.500008+oo .15509E+O1
.60000E+oo .17324E+O1
. 7000oE+oo .18070E+01
.80000E+00 .187588+01
.9000oE+oo .193998+O1
. 100008+01 .20000E+o1
AFTER 5 TTERATIONS
Fig. 7.19(b) Resultsfrom Program7.5
7.4.3 Weightedresidualmethods
where R is the 'residual' of the equation. Only the exact solution 1l(x)will satisfy the
boundary conditions and causeR to equal zero for all x.
Consider a trial solution f(x) of the form
The trial solution, which is made up of trial functions rltr,tltr, etc., satisfies the
boundary conditions of the differential equation, and contains a number of 'undeter-
mined parameters'Cr,Cr, etc. The trial solution (7.106)is differentiatedtwice, and
substituted inro (7.105)to give
Example7.13
Solution7.13
the boundarycondition,wecould derive
In order to find a trial solutionwhichsatisfies
a Lagrangianpolynomial(seeSection5.2.1)which passesthrough the points
x r
0 0
0.5 g
I 1
6G):r'(z-4a)-x(l -4a)
6&):F(x)+ Crtr$)
where F(x):2rz - t
Ct': -4a
*'(xl:x2 -x
R:1" -3x-4y
6":2(2-4a)
R : - 4 x 2 ( 2 +C r ) + x ( l + 4 C ) + 2 . ( 2 + c )
Example7.14
Solution 7.14
Y
v
0 0
I
3 a
1
3 b
I I
The values of the polynomial at x : { and I : } remain variable at this stageand will be
related to our two undetermined parameters.
The resulting polynomial is cubic, and given by
6 $ ) : \ l x 3 1 2 t a - 2 7 b+ 9 ) - x 2 ( 4 5 a - 3 6+b9 ) + x ( l 8 c- 9 b+ 2 ) l
which can be rearrangedin the generalform given by eq.7.106,i.e.
7.4.3.1Collocation
Example 7.15
Solution7.15
hence
x
6$):6(7x- l)
Note: If our trial solution had two undetermined parameters such as that given in
Example 7.l4,we could have collocated at x: * and x:3 to give two equations in the
unknown C, and C2.
7.43.2 Subdomain
In this method,the solutiondomainis split into as many 'subdomains'or partsof the
domainasthereareunknownCis. We thenintegratetheresidualovereachsubdomain
and set the resultto zero.Hence,for n undeterminedparameterswe have
xo (x (xn
Example7.16
Solution7.16
Using the trial solutionand residualfrom Solution7.13we haveone undetermined
parameterC1. In this casewe requireonly one'subdomain'whichis the solution
domain itself,hence
fr
1z+c r)+Ix'$ + qc) +2x(2+c,)li
I n ax: 1- gx3 :0
which givesCt: -lI
The trial solutionis thereforegivenby
In this method we integrate the squareof the residualover the full solution domain. We
then differentiatewith resp€ctto each of the undeterminedparametersin turn, and set
the result to zero. This has the effect of minimising the integral of the square of the
residual.
In generalwe write
$; a fB - fB aR
d x : 2 J rR A d x : o r o ri : 1 , 2 , . . . , n (7.112)
*, )^R2
wherethe solutiondomainis givenby A<x<8.
Hencefor n undeterminedparameters,we have
fB aR lB aR fB AR
lR#dx:0,
J,t QLr
l R fo,Ldz x : 0 , . . . , l n l OaCxn : O (7.1l3)
Jt )t
which leadsto n simultaneousequationsin the unknown C,'s.
Example7.17
Solution7.17
Using the trial solutionand residualfrom Solution7.13we haveone undetermined
parameterC1. Henceset
f l ^ D
I nildx:o
dcr
Jo
fr
i.e. I [ - q * ' Q + c , ) + x ( l + 4 c t ) + 2 ( 2 + c r ) ]( - 4 t ' + 4 x + 2 ) d x : 0
Jo
which givesCr:i$f
The trial solutionis thereforegivenby
- x)
Qg) : (2x2- x) - itt(x'
x
hence,0(u-):i(35x-8)
7.43.4 Galerkin'smethod
Example7.18
UseGalerkin'smethodto find a solutionto thediflerentialequationof Example7.13.
Solution7.18
t ^
I R / , ( r )d x : 0
Jo
i.e.
t '
-x)dx:0
I l - q r ' Q * c 1 ) + x ( l+ 4 c ) + 2 ( 2 + c 1 ) l ( x '
Jo
w h i c h g i v e sC r : - l
Qg):(2x2-x)-/(x2-x)
x
f{x):tr(5x- l)
Note: If our trial solution had two undetermined parameters,such as that given in
Example 7.14,we would have written
ft rl
lnry',(r)dx:o and lnpr(r)dx:o
JO JO
Collocation l:[{lx-tl
; ;
Subdomain y:f6{Zt*-S)
Leastsquares y:
]OS*-tl (7.116)
Galerkin t:f,{St- t)
7(e2'-e-2') 3
Exact r r - -
t- - - Y
-e-r)
41sz 4'
The error associatedwith eachof the trial solutionsis shownin Fig. 7.20.lt is clear
that for this example,no single method emergesas the 'best'.Indeedcach of the
methodsis the'most accurate'atsomepoint within the solutiondomain0<x<1.
For simpleproblemssuchas the onedemonstrated here,the collocationmethodis
the easiestto apply,because it doesnot requireany integration.For finite element
S O L U T I O N SO F O R D I N A R YD I F F E R E N T I AELO U A T I O N S 269
q -y
0.05
0.04
0.03
o.o2
0.01
0
-o.01
4.O2
-{.03
-{.04
-{.05
-o.06
a
Fig. 7.20 Error due to variousweightedresidualmethods
methods however, the Galerkin method is most often employed, becauseit can be
shown that use of the trial functions (or shapefunctions) as 'weighting' terms leads to
desirable properties such as symmetry of simultaneous equation coefficient matrices.
For comparison, the trial solution with two undetermined parametersdevelopedin
Example 7.14, has been derived using two-point collocation. It is left to the reader to
show that the resulting trial solution becomes
r W{x)Rdx:0 i : 1 , 2 , . . .n,
where the solution domain is.4<x<.B. In the previous exampleswith one undeter-
(7.1l 8)
( w,&\:o x*)
Collocation (
I tY,(r):1 *:L
Subdomain Wyg):r (7.1
re)
kast squares W { x ) : - 4 x 2+ 4 x + 2
Galerkin W1(x):f -1
w h e r e t h e s o l u t i o n d o m a i n w a s i n t h e r a n g e0 < x < 1 .
These weighting functions are summarisedin Fig.7.21.
C H A P T E R7
squares
\ \
n-l
7.5 Exercises
1 Given l':xysiny with },(l):l; estimatey(1.5)using Euler's method. L,ct (a) h:0.25,
h
I
t
( b )f t : 0 . 1 .
Answer:(a) 1.56a3,(b) 1.6963
Giventhe equation
t :l - x
lt + (v)'l't'
with {0):y'(0):0, cstimatey(0.5)usingthe midpoint rule with h:0.25 and fr:0.05.
a
Answer:0.1 124,0.1087
l0 Giventhe equation
v " + v + ( y ' ) 2= 0
subjecttoinitiatconditions)'(0):-l,y'(0):lestimatel0'5)andy'(0'5)usingthefourth
order Runge-Kuttamethodwith a steplengthof h:O'25'
Answer:-0.5164, 0.9090
d: -9sin 0
L
withinitialconditionAQl:rA,d(o):o'IfL:l0musethefourthorderRunge-Kutta
method to find the angular position of the rod after 0.5s.
Answer:0.7 (h:0.25)
with {0):2,y'(0) :0, estimate10.1) using one step of the fourth order Runge-Kutta
method.
Answer:0.1970
Ia+l:-)/a-3-t L wili
a=n-2
r ( .v
0 0.1
. , 0.1 0.1005
0.2 0.1020
0.3 0.1046
Answer - 0.1083
: Adams-Bashforthpredictor),(0.4)
26 Estimate the value of the cantilever tip deflection from Exercise 22 using a method of
weighted residuals with the trial solution
l:Ctx2 1C2x3.
Answer:All methods give exact solution 0.333.
l" *n2Y:a
subjectto boundary condition l0) : l, ),(1): - 0.8987,estimate10.5) using the trial solution
Johnson, L.W. and Riess, R.D. (1982). Numerical Analysis,3rd edn, Addison-Wesley, Reading Mass.
Lapidus, L. and Seinfeld,J. (1971).Numerical Solution of Ordinary Diflerential Equations,Academic Press,
New York.
Ralston, A. (1965). A First Course in Numerical Analysis, McCraw-Hill, New York.
Shoup, T.E. (1979). A Practical Guide to Computer Methods for Engineers, Prentice-Hall, Englewood Cliffs,
New Jersey.
Strang, G. and Fix, G- (1973).An Analysisof the Finite Element Method, Prentice-Hall, Englewood Cliffs.