section 5.4 runge-kutta methods
TRANSCRIPT
Section 5.4 Runge-KuttaMethods
Motivation
β’ How to design a high-order accurate method without knowledge of derivatives of π π‘, π¦ , which are cumbersome to compute.
π€&'( = π€& + βπ - π‘&, π€& ,where
π - π‘&, π€& = π π‘&, π€& +β2
ππππ‘
π‘&, π€& +ππππ¦
π‘&, π€& π π‘&, π€&
β’ Recall Taylor method of order 2:
π€&'( = π€& + β π(π(π‘& + πΌ(, π€& + π½(),thendeterminethecoefficients π(, πΌ(, π½( suchthat
|π(π π‘ + πΌ(, π¦ + π½( -π - π‘, π¦ | = π(β-)
β’Main idea: design a method of the form
Derivation of Runge-Kutta Method of Order Two
a) π - π‘, π¦ = π π‘, π¦ + H-IJIK
π‘, π¦ π‘ + H-IJIL
π‘, π¦ π‘ M π π‘, π¦ π‘ .
b) Using Talyor theorem of two variables (Thm 5.13 in textbook), π(π π‘ + πΌ(, π¦ + π½( = π(π π‘, π¦ + π(πΌ(
IJIK
π‘, π¦ + π(π½(IJIL
π‘, π¦
+π(π ( π‘ + πΌ(, π¦ + π½( <-- remainderβ’Matching coefficients in a) and b) βββ
π( = 1, πΌ( =β2, π½( =
β2π π‘, π¦ .
β’ The remainder term π(π ( π‘ + πΌ(, π¦ + π½( = π β- ---- >|π(π π‘ + πΌ(, π¦ + π½( β π - π‘, π¦ | = π(β-)
èèèThe new method is of order 2!!! (same order as Taylor 2)
Midpoint Method
β’ The midpoint method:
π€&'( = π€& + βπ π‘& +β2, π€& +
β2π π‘&, π€& ,
for each π = 0, 1, 2,β― ,π β 1.
Remark: Local truncation error of Midpoint method is π β- .The method is second-order accurate.
Two stage formula of Midpoint Method
Wπ( = π(π‘&, π€&)
π- = π π‘& +β2, π€& +
β2π(
π€&'( = π€& + βπ-for each π = 0, 1, 2,β― ,π β 1.
β’ Example 2. Use the Midpoint method with π = 2 to solve the IVPπ¦Y = π¦ β π‘- + 1, 0 β€ π‘ β€ 2, π¦ 0 = 0.5.
(MATLAB) Implement the method using β = 0.2. Record the maximum error.
Midpoint
Modified Euler Methodβ’ This is another Runge-Kutta method of order two:
The modified Euler method:
π€&'( = π€& +β2π π‘&, π€& + π π‘&'(, π€& + βπ π‘&, π€&
for each π = 0, 1, 2,β― ,π β 1.
Remark: Local truncation error of Modified Euler method is π β- .
Two stage formula of Modified Euler Method
\π( = π(π‘&, π€&)
π- = π π‘& + β, π€& + βπ(π€&'( = π€& +
β2[π( + π-],
for each π = 0, 1, 2,β― ,π β 1.
Example 2. Use the modified Euler method with π = 2 to solve the IVP
π¦Y = π¦ β π‘- + 1, 0 β€ π‘ β€ 2, π¦ 0 = 0.5.(MATLAB) Implement the method using β = 0.2. Record the maximum error.
Runge-Kutta Order Four (RK4)π( = π π‘&, π€&
π- = π π‘& +β2 ,π€& +
β2 π(
π_ = π(π‘& +β2,π€& +
β2π-)
π` = π(π‘& + β,π€& + β π_)
,
π€&'( = π€& +β6 [π( + 2π- + 2π_ + π`],
for each π = 0, 1, 2,β― ,π β 1.
Remark: RK4 hasfour stages,andisthe mostwidelyusedRKmethod.Its local truncation error is π β` . , π. π., fourth order accurate.
Example 3. Use RK4 with π = 2 to solve the IVPπ¦Y = π¦ β π‘- + 1, 0 β€ π‘ β€ 2, π¦ 0 = 0.5.
(MATLAB) Implement the method using β = 0.2. Record the maximum error.