Euler's Method: X FTX XT X
Euler's Method: X FTX XT X
Model Problem:
x ' = f (t , x) x(t0 ) = x0
(1) Only a few of them that we can find analytic solutions. For example when f (t , x ) = p (t ) x + g (t ) , we can use integrating factor to solve the problem analytically. In general, we need to find the solution numerically, which means, instead of finding a analytic expression of the solution x(t ) , we need a table of the values of the solutions
t0 x0
t1 x0
t2 x2
t3 x3
tm xm
First. "iven the value x(t0 ) , consider the value of x(t1 ) = x( x0 + h) . #y $aylor expansion%
x (t 0 + h ) = x (t 0 ) + hx '(t 0 ) +
h2 h3 x ''(t 0 ) + x '''(t 0 ) + 2! 3!
&hen h is small, h ' 1 , we can drop the high order terms, then
h2 h3 x ''(ti 1 ) + x '''(ti 1 ) + + 2! 3!
x(ti ) xi = xi 1 + hf (ti , xi ) .
x (t i ) = x (t i 1 + h ) = x (t i 1 ) + hx '(t i 1 ) +
h2 h3 x ''(t i 1 ) + x '''(t i 1 ) + 2! 3!
x(ti 1 ) xi 1 x '(ti 1 ) = f (ti 1 , x (ti 1 )) f (ti 1 , xi 1 ) x ''(ti 1 ) = ( f (t , x(t ))) ' |t =ti1 = ( f '+ = f '(ti 1 , x(ti 1 )) + f '(ti 1 , xi 1 ) +
$herefore
f (ti 1 , xi 1 ) f (ti 1 , xi 1 ), x
f x ') |t =ti1 x
Example. $ry to use $aylor (eries 0ethod to solve this initial value problem%
Runge-Kutta Methods
#asically, what we do for $aylor (eries 0ethod is the following%
h2 x ''(t ) + O(h3 ), 2!
f (t + h, x + hf ) = f + hf t + hff x + O (h 2 ) ,
then
f t + ff x = ( f (t + h, x + hf ) f ) / h + O( h) ,
so
h x (t + h ) = x (t ) + hf (t , x ) + (f (t + h , x + hf ) f ) + O ( h 3 ) , 2
i.e.
x (t + h ) = x (t ) +
h h f (t , x ) + (f (t + h , x + hf (t , x ))) + O ( h 3 ) . 2 2
Method!
&e want to find {t = ti 1 , x (ti 1 ) xi 1} {t = ti , x(ti ) xi } , we can do that in this way% Heuns Method:
F1 = hf (ti 1 , xi 1 ), F2 = hf (ti , xi 1 + F1 ), 1 1 xi = xi 1 + F1 + F2 . 2 2
In general,
w1 + w2 = 1 1 w2 = 2 1 w2 = 2
(1 un!nowns, / e2uations).
$his linear system has many solutions, different solution corresponding to different method. For example%
1 w1 = 2 1 4eun.s 0ethod w2 = . 2 = 1 = 1
&e can also choose the following solution, which gives us the so5called Modi"ied Euler Method
F1 = hf (ti 1 , xi 1 ), 1 1 F2 = hf (ti 1 + h, xi 1 + F1 ), 2 2 xi = xi 1 + F2 .
0oreover, we can !eep more terms in the $aylor expansion, and do the exact same procedure as before. $his will give us high order numerical method for initial value problems. $hese methods usually are called 6unge5,utta Familay, and the following is a fourth5order 6unge5,utta 0ethod% 4th Order Runge-Kutta Method:
#mpli$it Method
$he differential e2uation solvers we have presented so far are explicit, meaning that there is an explicit formula for the new approximation in terms of !nown data. It turns out that some differential e2uations are poorly served by explicit methods. 4ere, we will introduce the implicit method.
$he difference is% -uler.s method uses the old approximation to obtain the new one without solving an e2uation, bac!ward -uler method need to solve a e2uation to get a new approximation.
Example: use -uler.s method and #ac!ward -uler.s method to solve the following I89%
Stability: $he stability of a method can be even more important than its accuracy. )ext example will show you why bac!ward -uler method is stable.
x ' = x + 8x ^ 2 9 x ^ 3 x (0) = 1/ 2