Runge-Kutta Scheme Takes the Form K1 = Hf (Tn, Yn); K2 = Hf (Tn + Αh, Yn + Βk1); (5.11) Yn+1 = Yn + A1k1 + A2k2
Total Page:16
File Type:pdf, Size:1020Kb
Approximate integral using the trapezium rule: h Y (t ) ≈ Y (t ) + [f (t ; Y (t )) + f (t ; Y (t ))] ; t = t + h: n+1 n 2 n n n+1 n+1 n+1 n Use Euler's method to approximate Y (tn+1) ≈ Y (tn) + hf (tn; Y (tn)) in trapezium rule: h Y (t ) ≈ Y (t ) + [f (t ; Y (t )) + f (t ; Y (t ) + hf (t ; Y (t )))] : n+1 n 2 n n n+1 n n n Hence the modified Euler's scheme 8 K1 = hf (tn; yn) > h <> y = y + [f (t ; y ) + f (t ; y + hf (t ; y ))] , K2 = hf (tn+1; yn + K1) n+1 n 2 n n n+1 n n n > K1 + K2 :> y = y + n+1 n 2 5.3.1 Modified Euler Method Numerical solution of Initial Value Problem: dY Z tn+1 = f (t; Y ) , Y (tn+1) = Y (tn) + f (t; Y (t)) dt: dt tn Use Euler's method to approximate Y (tn+1) ≈ Y (tn) + hf (tn; Y (tn)) in trapezium rule: h Y (t ) ≈ Y (t ) + [f (t ; Y (t )) + f (t ; Y (t ) + hf (t ; Y (t )))] : n+1 n 2 n n n+1 n n n Hence the modified Euler's scheme 8 K1 = hf (tn; yn) > h <> y = y + [f (t ; y ) + f (t ; y + hf (t ; y ))] , K2 = hf (tn+1; yn + K1) n+1 n 2 n n n+1 n n n > K1 + K2 :> y = y + n+1 n 2 5.3.1 Modified Euler Method Numerical solution of Initial Value Problem: dY Z tn+1 = f (t; Y ) , Y (tn+1) = Y (tn) + f (t; Y (t)) dt: dt tn Approximate integral using the trapezium rule: h Y (t ) ≈ Y (t ) + [f (t ; Y (t )) + f (t ; Y (t ))] ; t = t + h: n+1 n 2 n n n+1 n+1 n+1 n Hence the modified Euler's scheme 8 K1 = hf (tn; yn) > h <> y = y + [f (t ; y ) + f (t ; y + hf (t ; y ))] , K2 = hf (tn+1; yn + K1) n+1 n 2 n n n+1 n n n > K1 + K2 :> y = y + n+1 n 2 5.3.1 Modified Euler Method Numerical solution of Initial Value Problem: dY Z tn+1 = f (t; Y ) , Y (tn+1) = Y (tn) + f (t; Y (t)) dt: dt tn Approximate integral using the trapezium rule: h Y (t ) ≈ Y (t ) + [f (t ; Y (t )) + f (t ; Y (t ))] ; t = t + h: n+1 n 2 n n n+1 n+1 n+1 n Use Euler's method to approximate Y (tn+1) ≈ Y (tn) + hf (tn; Y (tn)) in trapezium rule: h Y (t ) ≈ Y (t ) + [f (t ; Y (t )) + f (t ; Y (t ) + hf (t ; Y (t )))] : n+1 n 2 n n n+1 n n n 5.3.1 Modified Euler Method Numerical solution of Initial Value Problem: dY Z tn+1 = f (t; Y ) , Y (tn+1) = Y (tn) + f (t; Y (t)) dt: dt tn Approximate integral using the trapezium rule: h Y (t ) ≈ Y (t ) + [f (t ; Y (t )) + f (t ; Y (t ))] ; t = t + h: n+1 n 2 n n n+1 n+1 n+1 n Use Euler's method to approximate Y (tn+1) ≈ Y (tn) + hf (tn; Y (tn)) in trapezium rule: h Y (t ) ≈ Y (t ) + [f (t ; Y (t )) + f (t ; Y (t ) + hf (t ; Y (t )))] : n+1 n 2 n n n+1 n n n Hence the modified Euler's scheme 8 K1 = hf (tn; yn) > h <> y = y + [f (t ; y ) + f (t ; y + hf (t ; y ))] , K2 = hf (tn+1; yn + K1) n+1 n 2 n n n+1 n n n > K1 + K2 :> y = y + n+1 n 2 Taylor Series of f (tn + h; Y (tn) + K1) in two variables: @ @ K = h f (t ; Y (t )) + h f (t ; Y (t )) + K f (t ; Y (t )) + O h2; K 2 : 2 n n @t n n 1 @Y n n 1 Since K1 = hf (tn; Y (tn)) = O(h), 1 (K + K ) = hf (t ; Y (t )) 2 1 2 n n h2 @ @ + f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )) + O h3 ; 2 @t n n n n @Y n n Expression to be compared with Taylor expansion of Y (tn+1) 5.3.1 Modified Euler Method | Local truncation error (1/3) Local truncation error due to the approximation: 1 Y (t ) ≈ Y (t ) + (K + K ) n+1 n 2 1 2 where K1 = hf (tn; Y (tn)) and K2 = hf (tn + h; Y (tn) + K1). Since K1 = hf (tn; Y (tn)) = O(h), 1 (K + K ) = hf (t ; Y (t )) 2 1 2 n n h2 @ @ + f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )) + O h3 ; 2 @t n n n n @Y n n Expression to be compared with Taylor expansion of Y (tn+1) 5.3.1 Modified Euler Method | Local truncation error (1/3) Local truncation error due to the approximation: 1 Y (t ) ≈ Y (t ) + (K + K ) n+1 n 2 1 2 where K1 = hf (tn; Y (tn)) and K2 = hf (tn + h; Y (tn) + K1). Taylor Series of f (tn + h; Y (tn) + K1) in two variables: @ @ K = h f (t ; Y (t )) + h f (t ; Y (t )) + K f (t ; Y (t )) + O h2; K 2 : 2 n n @t n n 1 @Y n n 1 5.3.1 Modified Euler Method | Local truncation error (1/3) Local truncation error due to the approximation: 1 Y (t ) ≈ Y (t ) + (K + K ) n+1 n 2 1 2 where K1 = hf (tn; Y (tn)) and K2 = hf (tn + h; Y (tn) + K1). Taylor Series of f (tn + h; Y (tn) + K1) in two variables: @ @ K = h f (t ; Y (t )) + h f (t ; Y (t )) + K f (t ; Y (t )) + O h2; K 2 : 2 n n @t n n 1 @Y n n 1 Since K1 = hf (tn; Y (tn)) = O(h), 1 (K + K ) = hf (t ; Y (t )) 2 1 2 n n h2 @ @ + f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )) + O h3 ; 2 @t n n n n @Y n n Expression to be compared with Taylor expansion of Y (tn+1) 0 Substitute Y (tn) = f (tn; Y (tn)) and 00 d @ d @ Y (tn)= f (t; Y (t)) = f (tn; Y (tn)) + Y (tn) f (tn; Y (tn)); dt @t dt @Y tn @ @ = f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )); @t n n n n @Y n n to get Y (tn + h) = Y (tn) + hf (tn; Y (tn)) h2 @ @ + f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )) + O h3 : (5.10) 2 @t n n n n @Y n n 5.3.1 Modified Euler Method | Local truncation error (2/3) Taylor Series of Y (tn+1) = Y (tn + h): h2 Y (t + h) = Y (t ) + hY 0(t )+ Y 00(t )+ O h3 : n n n 2 n and 00 d @ d @ Y (tn)= f (t; Y (t)) = f (tn; Y (tn)) + Y (tn) f (tn; Y (tn)); dt @t dt @Y tn @ @ = f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )); @t n n n n @Y n n to get Y (tn + h) = Y (tn) + hf (tn; Y (tn)) h2 @ @ + f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )) + O h3 : (5.10) 2 @t n n n n @Y n n 5.3.1 Modified Euler Method | Local truncation error (2/3) Taylor Series of Y (tn+1) = Y (tn + h): h2 Y (t + h) = Y (t ) + hY 0(t )+ Y 00(t )+ O h3 : n n n 2 n 0 Substitute Y (tn) = f (tn; Y (tn)) to get Y (tn + h) = Y (tn) + hf (tn; Y (tn)) h2 @ @ + f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )) + O h3 : (5.10) 2 @t n n n n @Y n n 5.3.1 Modified Euler Method | Local truncation error (2/3) Taylor Series of Y (tn+1) = Y (tn + h): h2 Y (t + h) = Y (t ) + hY 0(t )+ Y 00(t )+ O h3 : n n n 2 n 0 Substitute Y (tn) = f (tn; Y (tn)) and 00 d @ d @ Y (tn)= f (t; Y (t)) = f (tn; Y (tn)) + Y (tn) f (tn; Y (tn)); dt @t dt @Y tn @ @ = f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )); @t n n n n @Y n n 5.3.1 Modified Euler Method | Local truncation error (2/3) Taylor Series of Y (tn+1) = Y (tn + h): h2 Y (t + h) = Y (t ) + hY 0(t )+ Y 00(t )+ O h3 : n n n 2 n 0 Substitute Y (tn) = f (tn; Y (tn)) and 00 d @ d @ Y (tn)= f (t; Y (t)) = f (tn; Y (tn)) + Y (tn) f (tn; Y (tn)); dt @t dt @Y tn @ @ = f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )); @t n n n n @Y n n to get Y (tn + h) = Y (tn) + hf (tn; Y (tn)) h2 @ @ + f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )) + O h3 : (5.10) 2 @t n n n n @Y n n and 1 (K + K ) = hf (t ; Y (t )) 2 1 2 n n h2 @ @ + f (t ; Y (t )) + f (t ; Y (t )) f (t ; Y (t )) + O h3 2 @t n n n n @Y n n 1 imply that Y (t ) = Y (t ) + (K + K ) + O h3 .