Upload
frey
View
44
Download
1
Embed Size (px)
DESCRIPTION
Numerical Analysis. Lecture 37. Chapter 7 Ordinary Differential Equations. Introduction Taylor Series Euler Method Runge-Kutta Method Predictor Corrector Method. TAYLOR’S SERIES METHOD. We considered an initial value problem described by. - PowerPoint PPT Presentation
Citation preview
Lecture 37Lecture 37
NumericalAnalysis
NumericalAnalysis
Chapter 7Ordinary
Differential Equations
Chapter 7Ordinary
Differential Equations
IntroductionIntroductionTaylor SeriesTaylor SeriesEuler MethodEuler MethodRunge-Kutta MethodRunge-Kutta MethodPredictor Corrector Predictor Corrector MethodMethod
TAYLOR’S TAYLOR’S SERIESSERIES
METHODMETHOD
We considered an initial value We considered an initial value problem described byproblem described by
0 0( , ), ( )dy
f t y y t ydt
We expanded We expanded y y ((t t ) by Taylor’s ) by Taylor’s series about the point series about the point tt = = tt00
and obtain and obtain
20
0 0 0 0
( )( ) ( ) ( ) ( ) ( )
2!
t ty t y t t t y t y t
3 40 0
0 0
( ) ( )( ) ( )
3! 4!IVt t t t
y t y t
Noting that Noting that ff is an implicit is an implicit function of function of yy, we have, we have
( , )
x y
y f t y
f f dyy f ff
x y dx
SimilarlySimilarly
2
2
2
2
( ) ( )
2 ( )
3 3
( 2 )
3( )( )
( )
xx xy xy yy y x y
xx xy yy y x y
IVxxx xxx xyy
y xx xy yy
x y xy yy
y x y
y f ff f f ff f f ff
f ff f f f f ff
y f ff f f
f f ff f f
f ff ff ff
f f ff
EULER EULER METHODMETHOD
Consider the differential Consider the differential equation of first order with equation of first order with the initial condition the initial condition yy((tt00) = ) = yy00..
( , )dy
f t ydt
The value of y corresponding The value of y corresponding to to tt = = tt11
1 0 1 0 0 0( ) ( , )y y t t f t y
SimilarlySimilarly
2 1 1 1( , )y y hf t y
Then, we obtained the Then, we obtained the solution in the form of a solution in the form of a recurrence relationrecurrence relation
1 ( , )m m m my y hf t y
MODIFIED MODIFIED EULER’S EULER’S METHODMETHOD
The recurrence relationThe recurrence relation
(1)1 1
1
( , ) ( , )
2m m m m
m m
f t y f t yy y h
is the is the modified Euler’s modified Euler’s methodmethod..
RUNGE – RUNGE – KUTTA KUTTA
METHODMETHOD
These are computationally, These are computationally, most efficient methods in most efficient methods in terms of accuracy. They terms of accuracy. They were developed by two were developed by two German mathematicians, German mathematicians, Runge and Kutta. Runge and Kutta.
They are distinguished by They are distinguished by their orders in the sense that their orders in the sense that they agree with Taylor’s they agree with Taylor’s series solution up to terms of series solution up to terms of hhrr, where , where rr is the order of the is the order of the method. These methods do method. These methods do not demand prior not demand prior computation of higher computation of higher derivatives of y(t) as in TSM.derivatives of y(t) as in TSM.
Fourth-order Runge-Kutta Fourth-order Runge-Kutta methods are widely used for methods are widely used for finding the numerical finding the numerical solutions of linear or non-solutions of linear or non-linear ordinary differential linear ordinary differential equations, the development of equations, the development of which is complicated which is complicated algebraically. algebraically.
Therefore, we convey the Therefore, we convey the basic idea of these methods basic idea of these methods by developing the second-by developing the second-order Runge-Kutta method order Runge-Kutta method which we shall refer hereafter which we shall refer hereafter as R-K method.as R-K method.
Please recall that the modified Please recall that the modified Euler’s method: which can be Euler’s method: which can be viewed asviewed as
1n ny y h (average of slopes) (average of slopes)
This, in fact, is the basic idea This, in fact, is the basic idea of R-K method. of R-K method.
Here, we find the slopes not Here, we find the slopes not only at only at ttnnbut also at several but also at several
other interior points, and take other interior points, and take the weighted average of these the weighted average of these slopes and add to slopes and add to yynn to get to get
yyn+1n+1. Now, we shall derive the . Now, we shall derive the
second order R-K method in second order R-K method in the following slides.the following slides.
Consider the IVPConsider the IVP
( , ), ( )n n
dyf t y y t y
dt
We also define We also define
1 2 1( , ), ( , )n n n nk hf t y k hf t h y k
and take the weighted and take the weighted average of average of kk1 1 and and kk2 2 and add and add
to to yynn to get to get yyn+1n+1
We seek a formula of the We seek a formula of the formform
1 1 1 2 2n ny y W k W k
Where Where are constants are constants to be determined so that the to be determined so that the above equation agree with the above equation agree with the Taylor’s series expansion as Taylor’s series expansion as high an order as possiblehigh an order as possible
1 2, ,W and W
Thus, using Taylor’s series Thus, using Taylor’s series expansion, we haveexpansion, we have
1
2 3
( ) ( ) ( )
( ) ( )2 6
n n n
n n
y t y t hy t
h hy t y t
Rewriting the derivatives of Rewriting the derivatives of y in terms of y in terms of ff of the above of the above equation, we getequation, we get
2
1 ( , ) ( )2n n n n t y
hy y hf t y f ff
32 42 ( ) ( )
6 tt ty yy y t y
hf ff f f f f ff O h
Here, all derivatives are Here, all derivatives are evaluated at (evaluated at (ttnn, , yynn).).
Next, we shall rewrite the given Next, we shall rewrite the given equation after inserting the equation after inserting the expressions or expressions or kk1 1 and and kk22 as as
1 1
2 1
( , )
( , )n n n n
n n
y y W hf t y
W hf t h y k
Now using Taylor’s series Now using Taylor’s series expansion of two variables, we expansion of two variables, we obtainobtain
1 1
2 1
( , )
( , ) ( )
n n n n
n n t y
y y W hf t y
W h f t y hf k f
2 22 2
311 ( )
2 2n ty yy
khf h k f f O h
Here again, all derivatives are Here again, all derivatives are computed at (computed at (ttnn, , yynn). On ). On
inserting the expression for inserting the expression for kk11, the above equation , the above equation
becomesbecomes1 1 2 2( ) ( )n n t yy y W W hf W h hf hff
2 2 2 22 2 3( )
2 2tt ty yy
h hf h ff f f O h
On rearranging in the On rearranging in the increasing powers of increasing powers of hh, we get, we get
21 1 2 2( ) ( )n n t yy y W W hf W h f ff
2 223 4
2 ( )2 2
ytt ty
f ffW h f ff O h
Now, equating coefficients of Now, equating coefficients of hh and and hh22 in the two equations, in the two equations, we obtainwe obtain
1 2 21, ( )2
t yt y
f ffW W W f ff
ImplyingImplying
1 2 2 2
11,
2W W W W
Thus, we have three equations Thus, we have three equations in four unknowns and so, we in four unknowns and so, we can chose one value can chose one value arbitrarily. Solving we getarbitrarily. Solving we get
1 22 2
1 11 , ,
2 2W W
W W
where Wwhere W22 is arbitrary and various is arbitrary and various
values can be assigned to itvalues can be assigned to it
We now consider two cases, We now consider two cases, which are popularwhich are popular
Case ICase I If we choose WIf we choose W22 = 1/3, = 1/3,
then Wthen W11 = 2/3 and = 2/3 and 3/ 2.
1 1 2
1(2 )
3n ny y k k
1 2 1
3 3( , ), ,
2 2k hf t y k hf t h y k
Case II: If we consider Case II: If we consider WW22 = ½, then = ½, then WW11 = ½ and = ½ and
1.
ThenThen1 2
1 2n n
k ky y
1 2 1( , ), ( , )k hf t y k hf t h y k
In fact, we can recognize that In fact, we can recognize that this equation is the modified this equation is the modified Euler’s method and is Euler’s method and is therefore a special case of a 2therefore a special case of a 2ndnd order Runge-Kutta method. order Runge-Kutta method. These equations are known as These equations are known as 22ndnd order R –K Methods, since order R –K Methods, since they agree with Taylor’s series they agree with Taylor’s series solution up to the term solution up to the term hh22..
Defining the local truncation Defining the local truncation error, TE, as the difference error, TE, as the difference between the exact solution between the exact solution yy((ttn+1n+1) at ) at tt = = ttn+1n+1 and the and the
numerical solution numerical solution yyn+1n+1, ,
obtained using the second obtained using the second order R – K method, we haveorder R – K method, we have
1 1( )n nTE y t y
Now, substitutingNow, substituting
2 1
1 1, 1 , ,
2 2W W
2
1 ( )2 nn n tt t y t t
hy y hf f ff
32( 2 )
4 ntt ty yy t t
hf ff f f
into the above equation, we getinto the above equation, we get
Finally, we obtainFinally, we obtain
3 21 1( 2 ) ( )
6 4 6tt ty yy y t yTE h f ff f f f f ff
The expression can further The expression can further be simplified tobe simplified to
3 1 1( )
6 4 6y yTE h y f y f y
Therefore, the expression for Therefore, the expression for local truncation error is given local truncation error is given byby 3 1
6 4 4 yTE h y f y
Please verify that the Please verify that the magnitude of the TE in case I magnitude of the TE in case I is less than that of case IIis less than that of case II
Following similar procedure, Following similar procedure, Runge-Kutta formulae of any Runge-Kutta formulae of any order can be obtained. order can be obtained. However, their derivations However, their derivations becomes exceedingly becomes exceedingly lengthy and complicated.lengthy and complicated.
Amongst them, the most Amongst them, the most popular and commonly popular and commonly used in practice is the R-K used in practice is the R-K method of fourth-order, method of fourth-order, which agrees with the which agrees with the Taylor series method up to Taylor series method up to terms of terms of O O ((hh44). ).
This well-known fourth-This well-known fourth-order R-K method is order R-K method is described in the described in the following steps.following steps.
1 1 2 3 4
1( 2 2 )
6n ny y k k k k
1
12
23
4 3
( , )
,2 2
,2 2
( , )
n n
n n
n n
n n
k hf t y
khk hf t y
khk hf t y
k hf t h y k
wherewhere
Please note that the second-Please note that the second-order Runge-Kutta method order Runge-Kutta method described above requires described above requires the evaluation of the the evaluation of the function twice for each function twice for each complete step of complete step of integration. integration.
Similarly, fourth-order Similarly, fourth-order Runge-Kutta method Runge-Kutta method requires the evaluation of requires the evaluation of the function four times. The the function four times. The discussion on optimal discussion on optimal order R-K method is very order R-K method is very interesting, but will be interesting, but will be discussed some other time.discussed some other time.
Lecture 37Lecture 37
NumericalAnalysis
NumericalAnalysis