t

advertisement
l_
l_
l_
t
AN AICORITHM
FOR APPROXIMATINC
TIIE SOLUTION TO A GENERAI. TM.S'I OllDER
SYSTEM O!' DIFFERENTIAL
EOUATiONS
t
t
I
I
I
I
t
I
I
I
I
I
I
I
I
Prepared fo!
U. S. Naval Weapon6 Laboratoly
DatI1gren, Vi!ginla
By
He!bert
Der6hern
Augurt 196?
U N I V E R S I TOYF D A Y T O N
D A Y T O NO
, HIO
I
I
II
l
I
I
I
I
t
t
I
I
I
I
I
I
I
t
UDRI-Ti\4- 67- 13?
AN ALCORITFIN4 FOR APPTTOXIMATINC
THE SOTUTION TO A GJ'NERAL FIRST ORDER
SYSTEM OF DIFFERNNTIAL
IQUATIONS
Firepa!ecl {or
U, S, Naval Weapo[s Laboratory
Dahlgren, Virglnia
By
Herbert Dershenr
August 196?
UNIVERSITY OF DAYTON
Resear:ch Instltute
Dayton,
Ohio
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
T
t_
PROBI.EM
This report presents an algoritlrnr fox approxr'mating the solution to a
general Iirst order system of or.diDaxy difterential cquations of the form
(1) v' = ?rt,t
lA
v(t)
=
i
whe,_c I is a vector of deperdent variables, t an inalepenclentvariable ancl i
a function vecior. The algoritbn'r util.j.zes a multistep technique oJ Cr:ane and
Klopfenstein [ 3] , and special procedures for 6tarting the approximation,
stability control and interval rnodification. These procedures are discussed
at some length in thi6 xeport.
Included in the Appenclicies axe sample applicatioDs oJ some of thc
di6cussed techniqrles,
METHOD OF APPROXIMA'TINC THI' SO],UTION
The common methods -[or approximating the sohrtion o{ a system of
thc forrn {l) - (2) can be divided into lorr sroups:
(i)
One-stcp schemes of the Runge-Kutta type.
(ii)
One-srep schemes of the Nord6ieck type.
(iii)
Predictor-corlector
(iv)
Predictor-corrector
schemes of the multistcp
(terminology from Gear [ 4] ).
[ 5]
Echentes of the Adamts type.
type
Group (i) schemes can be ruled out irnlnediately in most cases because
thcy usually require {our times as rnany castly evaluations ot fas 1rrethods
fro]r-r any oI the otber groups and do not provide an economical lr1easr1re oJ the
l r r r n c a L i on c r r : o r .
Croup (ii) has rnuch to recomrnend it, especially in the case when one
is lrtorklng lvith a system ol higher order equations. Since schemes of this
forlrl are one-step, they have the advantage oI being se1{-starting in a qualified
rnanner.
They also provide an easily attainable rl.leas!1re oI the trlrncation error
and stability and allow the interval size to be changed easily. Horvever, lor
first order sfstems,
the e.{uivalent group (iv) schcl-Ile has greater sirnDlicity and
is therefore chosen in this special case,
I
l
t
group {iii) is a subset o{ group (i\4, bui: since the u6e o{
In reality,
-Adams IylJ() llctlrods axe so co rrrlon, thcv raie a c1.1ss oI thcir ow:r, This
type o{ mcthod is generally not pxe{erred,
horvever, over those oI group {iv)
because a multistcp rnethod which uses the salne number of prcviorls points
has eitlLer a bithcr order truncation error or a larger regj.on of stability,
with the onLy cost beir'lg storage, which is not a high pxice on rr1odcrn machines.
:
:
I
I
I
I
I
II
I
I
I
I
I
I
I
Hencc, it is an algorithrr-r lor solving the systerrr (1) , (2) using a
methocl o{ group (iv) that will be descxibecl in thc following.
The particulax
mer:nber of this gro!1p that is recomrtrlended j.s the one suggested by Cran.e and
Klopfcnstein [ 3] , espccially if one wishes to obtain a large region of stability
near the xeal axi6.
GENERA I, DESCR]P'I]ON OT 'II]E AI-CORITHM
A fl.ow diagran1 ol thc algorithm {or obtajning an approximation to
( 1 ) - ( 2 ) b y t h e p r e c l i c t o r - c o r r e c t o r m u l t i s t e p D r e t h o di s f o u n d i n F i g u r e 1 .
Thc autonratic sttLrting proccdure STARTBR, the intetval rnodific-atjon procedule6, HALVE and DOUBLE, and the boolean procedure for cletecting
i n s t a b i l . i t y , S T A B L E , a f e d e s c r i b e c li n s e p a r a t e s e c t i o n s a n d f l o w d i a g r a n r s .
A list oI the input to the al.gorithm and explanation oI the other symbols appearing in the flow diagrarns are founcl in'l'ab1e l.
The algorithm begins by calling on procedule STARTE]l which determines
an initial step size which rvill keep the truncation e1.ror within specified bounds
(< 11n* and < min) and insure absohlte stability. STARTER then integrates
forward the reqr.lired number o{ 6teps using a stlitable one-step tuethod. One
which is highly recommended for this purpose is the Rutrge-Kutta T€ichniclue
of Ralston [ 6] . The nurnber o{ steps evaluated by S'IAR'llnR depends trpon
the nru]rbc! of previorls points nceded by the choselr mrltistep rnethod.
Aftex STAR!fER has completcd its tash, a preclicted valueFnl.r ol the
depcndent variable vector ancl a colrectcd vatue yrr11 ar.e conrluted by t|.e
r n u l t i s t e p s c h c m e . T h e c o r r e c t o r i s r e i t e r a t c d , u s i n g t h e l a s t o b t z ' i n e dc o r r e c t ed vahre to compute the derivative, until the specifiecl number of derivative
evaluations, DPS, have been pex{orined. Notc that DPS can be, and usually
w i ] l b e ,o n e , i n w h i c h c a s e t h e c o r r e c t o r i s n o t r e i t c r a t e d a t a l l .
Once this is done, an estirllatiol'.,f thetruncatiorerror
is obtained,
Letting ei = L pni - ynt I where pni an.1 yni are the ith cor-nponcnts of p" ana
1., the crror et ihc ) lh srep is expi"ssed by
E..
=
-i
mln tei J _l
IYnil
z
I
I
I
I
START
STARTER
I
I
Comp
' u t c 'Dn + -t .
r " ni - I ' Y r + I s Y
HATVtr
e.) €ma*
Compute
K r D P S -I
Compute yi+I ..nd
reapply the cor ! ecto I
to obtain ne\v v' n i l K: = K+]
DOUBLE
t=t+h
STABLE
"b 'c
PRINT
MESSACE
' 1 ,
.
__ _;ni
\2
Compute
'
'vn . F . r ,
I.,+1
.
s ch3'!e.
Figure 1(continued)
4
. t .
2
bI one-steP
h: =l- h
w h e r e t h e w i a r e w e j g h t J ? r c t o r s t o b e d c t e ] ] l n j . r l c db y t h e u s e r ( 0 S w i S 1 ) .
IJ "li
E"l ( . -i,.,,
the irverval is clc,rrbtcci.tr "'i' r,''2
u.,.n'. ,
--ij.li.'.oi"c,
the jntelval is r'aiv.a.
th. valac of rhc inclep;(teni variable t
is ;Dcrementccl and a test is madc to see j{ thc stabilitycbeck should bc applied
at this pojnt.
The stabititt chech is schcduled lro occlr:r at a fixed interval (t-)
on t. tc is determiDed by the user ancl is cleperdent upon how n Lrch tjmc is
consumccl by thc stability check and how crucia,I stabiiity is in the pxobleln
being rur.
If the mcthod is not st?r.ble at this point, the step-size i.s halved,
the necessary bookkccping is done and the p]'ocess pr.oceccls. II it is stable
tlre program continues with thc next application of the D1..edicto,-.
A UTOMAl']C STARTlNC PllOCEDURE
I
I
I
Thc Inajor goal ol the autorlerticstalting proccdure STAR.IER (see
Figure 2) is to choose a starting value Jor the step sizc h consistcnt u,ith
requirements on trlrncation er.ror and absolutc stability.
Thc stabil.j.ty criitcrion is hancll.cdfirst.
:fhc injtial vahLe siven to h
is 1 which guarantees that hmin S h K hr.u* bccause of conditi.ons-on hr]ri,,
ancLhmax. Then a test is ]Tlaclefol. stability at thaX value of h. 1I the methorl
is stable, h is dor.rblccllrntil a value is Ic'und {or which Zh calrses instability
o r u n t i l 2 h ) h m a x , I l s t a b i l i t y c l o e sn o t h o l c l l o x h = . 1 , h i s b a l v c c l r e p c a t e d l y
untjl a stablc vahre oJ h is lorrnd or urrtil h is reducccl to less than hrrrir1, in v,,hich
c a s e a n c x p l a n a t o r y r n e s s a g e i s p r i u t e d a n d t h e p r o c e s s i s t o r . r l r i . n a t e d .W h e n a
suitable valuc ot h is louncl, the next k points are eval.uatecl(whcn the preclictorc o r r e c t o r i s z !k - s t c p m e t h o d ) b y t h e c h o s e n o n c - s t e p s t a r t i n g s c h c m e .
Now the value lor ]1 thus obtainecl is usccl as a prcclicted value in the
k-step cor:rector formula and a correctecl value of Tk js then conrputcd. T,he
dilference oJ tbese two approlinlations to !,- is then used to estimate the
truncation error at tk. I{ |his erlor is too Iar.ge, the stcp-sizc is halved and
the one-step method is again applicd starting at the initjal point. This proces,
is continuecl until a suitable ste!-size is {or-rndor h fa11s belorv hmin. In the
latter case the ptocess 1s halted,
It should bc noted here that the estimate of the truncation errol obtained
in this manner at tk will tencl to be conservative so that lhe starting step size
m a y b e s r T 1 a l 1 et rh a n n e c e s s a r y ,
STABILITY CIINCKINC PROCNDURE
A method is kno$,n to bc sta_bIe at a given point il a1l the zeros oi
tire characteristic
polyncrnial of the lt'letLod tie Nithin or on the unit circtc and
those lying on the unit circle are simple [ 3].
The coeflicients of j:he characte.istic polyronial involve terns contajniirg E $here E - h . ),i. The \i are
STARTXR:
14
,l
rq
h
t'l
. v
Zt
ia4
Compute ytj y2,
Yk bY one step scheme,
Use yk to obtain a
corrected value at
yL and e. at
"
r=kL.
RETURN
Figure 2 (continued)
I
e i g e n v a l u e s o { the matrix
J
utt
( r)ij
urj
l'hexefore,
the {irst step il1 checkj.ng stability is obtairing apirroximations
f o r { h c c j g c - \ i l l L , s \ i o { J . T l r ( 1 c . l - n i q - L L . s - dI o r i . c o r n p l i . I ' i n 6 t L : s j s r . p ! o
the user and will depend greatly on the nature ol f.
Next a l]rethod is applied to dete,..lnire vrhcther all oI thc zcros oI the
characteristj c polynomial of thc multistop technique are inside the unit circle.
The characteli6tic polynor:r\ial can be obtained using analysls similar to that o{
Cha$e l2],
Analytjcal Techniques (such as in [1]1, or previous knowledgeol
the region ot stabil.ity can be used to accomplish this purpose. Examples of
techniclues derivecl for a given problern are found in the appendices,
'fhi<
nr^.
^.l,, r a ; c
boolean iD nature and returns witb a true value i{ the
method is stable and with a lalsc value if the procedlue was unablc to verjfy
ab solute st:rbi1ity.
CHANG1I OIT ]NTERVAI,
II the trrncatj.on error is found to be too Iarge, the proceclure IIAI-VII
(Figrre 4) i.s cal.led upon. I-1ALVE check6 to s('e it halving thc step sizc would
result in a step sizc which is smallex than allowable and if there have becn rnore
than lhe allowable numbcr of halves inJlictcd (hn) rvithout the intcgration proc c e d j . n gl o t b e n e x t p o i n t . I n m o s t c a 6 e s h u s h o u l c lb e l , b u t l o r e x t r i e n r e l y
r a p i d l y c h a n g i n g{ , a I a r g e r h " m a y b e u s c d .
i r.'t
lernlinlrting conditions i€ pxesent, then y(t-;
r If neither oI tl)fse
y ( t - i hi ) h, .),,. .
. yV((tt----t. t h ) a r e c o m p u t e
c dcbl y m e a n s o J t h e
co n e
r sarne
c - s lt re p
p
r
o
c
e
d
u
r
e
.
m e t h o d w h i c h r v a s r r s c d - a sa s t a r t j . n e
h is then halved and the integration is r€surned by rcturning
to th. pr.edictor'-corrector
forlnulas.
If thc truncation erro!s are all smaller than the minirnum tolerable,
procedure DOUBLE (Figure 4b) is €rntclecl" DOUBI-E {irst checks that there
are enough points available Ior doubling to occur.
!'or a k-step methodrrenoughl
is 2k-I.
n
o
t
,
a
r
e
t
u
r
n
g
c
n
c
r
a
t
e
d
ff
is
ancl the proceclure does nothing. Next a
check is macle on how recently a doublc.ras attenpted but rejected because
of a stability criteriou.
If this has occurred within tc of the currert value of
t, tlle procedure r€iurns.
This is to prevent exccssive tir]1e-consumihg caIls
r\hr" lh. s1.l'.ize Jor slah'lity is sm?ll.r than lLat requi-ed b)
or SIABLI
truncation error,
Ncyt slabjl't) is cre.ked lor slep sizc 2h and 2h is co'rfared wirr hm-x
to insure that dolrbling $,or1ld not cause thc bound on h to be exceeded.
Il both
t
a
r
.
d
r
.
d.
h
L
e
d
o f t h e s c t e s t . - : r l I ov . h i s d o .
enCtLe o-c-i..rry book\c.ij-g
S1'ABLE:
ENTI]R
Cornpute ei!envalues
I.(i=1,.
., N1) of
Jacobian
l.l1atri:
at point
t.
TRUE
RE'IURN
.1ES
Zeros
p ( y , h M c on t a i n d
in unit ciIclo?
ir = i * I
M: = min
Re(Ii): 0
1m{\ i) : 0
Zeros
p(y,h\i) all
contained in unit
YES
Figure 3t
9
FALSE
RETURN
HSLVE:
ENTNR
PRINT
\4ESSACE
Compute v
y
-,
.
zK- I
n --z-
h:=+n
bv ol e- steo
metnocl
h c := h c +1
Figure 4a
DOUBLE:
revious poi.nts
available
RETURN
YES
RI]TURN
RETURN
( v ,2 r , )
h::2h
tL::t
'n- 1
' n-2
'n-k+l:
= 'n-2k-
R!-'TURN
TAB]-E
1
INPUT TO PREDICTOR. CORRECTOR PROCRAM
N
Nurnber of dependent variables (integer),
Yo
Initial values of dependent variables (rea1 1 X N axray).
Weights uBed to test truncation error {rea1 I X N array).
to
Initial value of independent variable (real).
tf
Terminating
tc
Increment of independeht valiab1e at which stability is to be checked (real).
N1
Degree oI the charactelistic
poly[omiaI
N2
Degree ol the characteri6tic
polynomial oi the P-C method (integer).
p {y, n,
Characteristic
hmax
Absolute maximurn ol step size (real).
value (if any) of independent valiable (real).
of the Jacobian (illteger),
polynomial of tbe P-C method (rea1 tuncti.on),
(t < h'''ax)
(0 < hmin < .])
Number of consecutive halves allowed at one poirt (integer).
Absolute minimu-rn oJ step 6ize.(!ea1).
Number of derivatives evaluationsper step (jnteger),
MCON
Constant u6ed in determiDing truncation error
€ ma:<
Upper bound on truncatiob erlor
{rea]).
€ min
Lowex bound on truncation error
(real).
(real).
Other variables in the llow charts but not input.
M
Largest real eigenvalue of the Jacobian at th€ current point (real).
Storage fo! the last value of the independent variable where a double
of step-size was attempted but rejected because o{ stability (real),
Value of lyn-pnl
X MCON.
(real I X Narray)
storage lor number of consectLtive halves (integer).
li
Temporary
t
Independent vatiable (rea1).
h
S t e p -s i z e ( r e a 1 ) ,
Value of the independent variable at the previous stability check (real).
t2
APPENDIX
A
STABI]-I:TY CRITERTON I'OR A SA\4PI-E PROBLEM
Let Y - l y ! , y z , y 3 , y a , y 5 ' y 6 ) a n d ? = ( \ , f 2 , \ , 1 4 , f 5 ,
consid.erthe s yster11
v
f6 )'
Then
= f (t,v)
t\ lt,t)
tz ft'j)
{3 (t,})
, lt,tl
1 5( t , T )
f6 {t,l)
= y4
= ys
=
=
=
=
y5
- E(ya-w*) - Auy5 + A y y 6 - C r y l
'Eys - g
- E(y6 -w*) - Ay I.r + A x y E
\rhe! e
E
=
E ( y z , y t ,Y r , I e =
)
=
Y . k . P ( y r ) v ( y 4 ,y 5 , y 5) . K p ( r + ,r r t Y t l .
Kp
Y ' k ' p ' v
Now y and k are constantg, p depends on yz {rorn a table, KD depends
V frorn a tabLe and
Therefor e
AE
Y_ ' V . k . l t . h . : *
u
OE
Byr
oyz
k ' Y ' PI # K o * f f -. +
"
But
8v
'
3 Y"
3E
k.1.p
AV
Dyt
b
rKfn
( y a- r v * )
AV
BKD,
'.- 6 v I
Jb-:wz-
4,5,6.1
Kn
OKn
a yt
k' r .n
A%
- * , )t +
k. y .p .(y6
ys [f
+-t;:l
Krr
D
.
e o
OKr
+#l
and ;!
can be obtained {1orn the tables used to lind Kp and p. If
=:.
o y
"yz
interpolatioD is linear the slope is con€tant between any lwo tabulax values,
Now let
f i_J
.
We compule
Bfi
0",
the following:
p- ty.-w")
ffi
-w*)
a,- (ra
ffi
ar- (va-w*)
ffi
f+t
AE
,54
lss
"
oY4
- E - '- OE
o
Ys
'
B!
Y5 -o
Y6
-*r,
- Ay- (y6
ffi
ar.- (ro-wr)ffi
- E- (yr,
-tr)
ffi
14 '.
!-o r
qv r:?
-. gv 1-!
,lvz
"-
dt.
9yz.
dfi
6
aYz
J.r
v i-3
Y2
:\
dy"
f i. ,J
,y i-3
t-.i*
fi,
,
-
)
Y z
t
fi,
jli
t
,y 1-3 = (.-l.r*
t 2
llence all fi
Y2.
di
' )
"
J
-
)
l
' 2
y 1 - 3 . v ,
-'-'---_
I -'ri: y r-3
! ,
.
ri.' J
can be comDLrted.
Th cx efor e , t h e J a c o b j a n M a t r i x J i s
0
0
0
-cr
0
0
0
ltz
0
0
0
0
0
0
f
o
Thc chatact. rjsr;c polyronirl
P (t)
z
l
0
I
5
o t u , " o
0
0
0
fr.o
5
0
foo
o . f r L i s n r : | , r . i xi s
tb + (f44 +f5s -ff66 ) t5 -t- (laat55 .l lal61, + lr. 166- 146l& - 14. 1r4
- f65f56 'f52+Cr)
t4 + ({44I55 f66 + f45 Jq6{64 + f46 f65 f5tr
- f.64f46t55 - t45 Ir4l66 - I44f6, f56 l151la2-1,t55162- 1'4152
- { 6 6 f 5 2{ c r { 5 5 + c r f 6 6 t 3 +
)
\ry!42lot ).ft4ru6l62if45 !5:152
- f5a|a6 162- l.'4f56 152- f64155ttz* CJs:, laa j'Grfsz-
lcrl56 162- CrI66 f5? ) t
Crf6s {56) tz
.
APPENDIX
B
TESTINC TO SEE IF ZEROS OF A POLYNOMIAI,
I-]E
INSIDE THE UNIT CIRCLE
.Two possible techniques will be discussed {or locating zeros oI the
The first is r11oretirne consuming, but also
chaxacterlstic polfnornial
more accurate than the second,
T h e f i r s t i s b a s c d u p o n a t e c h n i q u e s u g g e s t e db y C a l ! ( 1 ) , a n d u c e s
the concept of the wlnding nlrmber of the polynomial on the unit circle.
This is accoftplished by evaluating the polynomial at certain slna1l incrernents arou.nd the circle and counting the number of times the image curve
\rinds alound the origln.
The increment used in the actual progranr was
rrheneve! both the real and imaginary part of
decreased
U"t
i.t
was
,
f
the irnage changed sign ovc! a Bingle lncrement.
Thls eecond technique uses prior knowledge of the region ol stability
to determine dilectly from the eigenvalnes whether or not the method is
stable. }.or example, one coul.d simply check the largest circle ineide the
region to see if atl eigenvalues were contained in iii. This "lould allow
considerabl.e savings when calculating the eigeuvalues since only the ]a!gest
modulus need be founcl.
16
I
REFBRENCES
1)
Functlong,
zl
C a i n , G . L , , "A Method for Locating Zeros o{ Cornplex
ACM V o I . 9 , N o . 4 , I 9 6 6 , p p , 3 0 5 - 3 0 6 .
'r CoIIlrn.
(:La"e
P. r.,,Sf.Aili1..
Methods {or Ordinary Differential
p p . 4 5 7- 4 6 a .
D'nr^rLies oJ predictor.-Corrector
Equation€, " JoqI4aI AQM, Vo1. 9, 1962,
3)
C x a n e , R , L . , and Klopfenstcin, R. W. "A Pr edi ctor- Corr ector:
A l g o r i t h r n . , i t h a n I n c r e a s e d Range of Absolute Stabiiity, J' Jouxnal ACM, Vol,
lZ, 1965,pp. 22?-241.
4)
Cear, C. W., I'The Nu1nerical Integration of Ordinary
Di{terential Equatiohs of Vaxious Orders,rr Report iiANL-?126, Argonne
National Laboratoryr Argonne, I11., 1966.
5)
Nordsieck, A., "On Numerical Integration of Ordinary
Dilferential Equations,rrMath. Comp., Vo1. 16, 1962, pp, ZZ-49,
6)
Ralston, A,, rrRunge-Kutta Melhods with llinimum
r!!!g!\.'!939pBounds,
Voi. 16, I962, pp. 431-43?.
17
Erxor
Download