Ordinary differenial equaions Phys 750 Lecure 7
Ordinary Differenial Equaions Mos physical laws are expressed as differenial equaions These come in hree flavours: iniial-value problems boundary-value problems eigenvalue problems
Ordinary Differenial Equaions Mos physical laws are expressed as differenial equaions These come in hree flavours: iniial-value problems boundary-value problems firs order x () =F (x(),) x(0) = x 0 second order x () =F (x(),x(),) eigenvalue problems x(0) = x 0 x (0) = v 0
Ordinary Differenial Equaions Mos physical laws are expressed as differenial equaions These come in hree flavours: x R : u (x) =F (u(x),u(x); x) iniial-value problems boundary-value problems eigenvalue problems x R : u(x) = (x) or u (x) = (x)
Ordinary Differenial Equaions Mos physical laws are expressed as differenial equaions These come in hree flavours: x R : u (x) =F (u(x),u(x); x; ) iniial-value problems boundary-value problems eigenvalue problems x R : u(x) = (x) or u (x) = (x) soluions only a specific eigenvalues
Ordinary Differenial Equaions In principle, he iniial value problem ODE can be forward inegraed from is specified saring poin dx d = F (x(),) x(0) = x 0 x() =x 0 + 0 d F (x( ),) Need o generae a numerical esimae of he inegral on he rhs of he formal soluion
Ordinary Differenial Equaions As usual, we chop he real ime variable ino discree ime seps = i+1 i x( + ) =x()+ x( i+1 )=x( i )+ + i i+1 d F (x( ),) d F (x( ),) If is sufficienly small, hen he inegral is wellapproximaed by a low-order esimae of he area
Ordinary Differenial Equaions missing weigh Various firs-order approximaions: x i+1 = x i + F i x i+1 = x i + 1 2 F i + F i+1 where in he fuure x i = x( i ),F i = F (x( i ), i ) F(x(),) box rule i i+1 F(x(),) The choices of box and rapezoid inegraion correspond o he socalled Euler and Picard mehods i i+1 rapezoid rule
Ordinary Differenial Equaions Algorihm for he Euler mehod is very simple Accuracy of he mehod is low, and large errors accumulae over ime No necessarily energyconserving Se x 0 o is iniial value Sep hrough each i (i 0): compue F i = F (x i, i ) x i+1 = x i + F i i+1 = i +
Ordinary Differenial Equaions Se x 0 o is iniial value Picard mehod requires a selfconsisen soluion Accurae bu slow May no converge for oo large a choice of ime sep Sep hrough each i (i 0): compue F i = F (x i, i ) i+1 = i + compue x (1) i+1 via Euler Loop over k =1, 2, 3,... compue F (k) i+1 = F (x(k) i+1, i+1) x (k+1) i+1 = x i + 1 2 F i + F (k) i+1 Exi loop if x (k+1) i+1 x (k) i+1 < x i+1 = x (k max) i+1
Ordinary Differenial Equaions Sysemaic expansion: replace dummy variable by and Taylor expand he inegrand F (x( + ),+ ) =F (x(),)+ F x Inegraion over 0 < < x i+1 = x i + F i + 1 F i 2 yields = + F x i + x () + F F i ( ) 2 + Truncaion a firs order corresponds o he Euler mehod + O( ) 2 no necessarily available o us
Ordinary Differenial Equaions According o he mean value heorem, an exac runcaion is of he form x i+1 = x i + F (x( ), ), [ i, i+1 ] F is evaluaed a some inermediae poin Ideal value of absorbs all curvaure correcions Possibiliy of sysemaic improvemens
Ordinary Differenial Equaions Euler x i+1 E.g., second-order Runge-Kua x i x i+1 = x i + F (x, ) x = x i + 1 2 F (x i, i ) i i+1 = i + 1 2 Runge-Kua x* x i+1 local errors a O( ) 2 x i i * i+1
Runge-Kua Schemes Exac evoluion over a small ime sep: x( + ) =x()+ 0 d( ) F (x( + ),+ ) Expand boh sides in a small ime incremen: x( + ) =x()+x () + 1 2 x ()( )2 + 1 6 x ()+ = x()+f + 1 2 F + FF x ( ) 2 + 1 6 F +2FF x + F 2 F xx + FFx 2 + F F x ( ) 3 + parial derivaives
Runge-Kua Schemes Runge-Kua ansaz a order m: x( + ) =x()+ 1 c 1 + 2 c 2 + + m c m Funcion evaluaion a many poins in he inerval c 1 =( )F (x, ) c 2 =( )F (x + 21 c 1,+ 21 ) c 3 =( )F (x + 31 c 1 + 32 c 2,+( 31 + 32 ) ) c 4 =( )F (x + 41 c 1 + 42 c 2 + 43 c 3,+( 41 + 42 + 43 ) ). m equaions and m + m(m 1)/2 unknowns { i, ij }
Second-order ODEs We have discussed he Euler, Picard, and Runge-Kua schemes for inegraing he firs-order iniial value problem: x () =F (x(),) x(0) = x 0 Similar consideraions can be applied o he second-order problem: x () =F (x(),x(),) x(0) = x 0 x (0) = v 0
Second-order ODEs Convenien o reinerpre he second-order sysem as wo coupled firs-order equaions x () =F (x(),x(),) x(0) = x 0 x (0) = v 0 v () =A(x(),v(),) x () =v() x(0) = x 0 v(0) = v 0 Obvious connecion o classical mechanics: velociy v and acceleraion model A
Second-order ODEs Naive generalizaion of Euler mehod o he pair of firs order equaions Some ambiguiy in he labelling of ime seps Se x 0 and v 0 o heir iniial values Sep hrough each i (i 0): compue a i = A(x i,v i, i ) v i+1 = v i + a i x i+1 = x i + v i i+1 = i + Could equally read v i+1 and sill be correc o O( ) (Euler-Cromer)
Second-order ODEs Can achieve higher order algorihms sysemaically a he cos of having more ime seps involved in each updae x i+1 = x i + v i + 1 2 a i( ) 2 + O( ) 3 x i 1 = x i v i + 1 2 a i( ) 2 + O( ) 3 Adding and subracing he forward and reverse forms x i+1 =2x i x i 1 + a i ( ) 2 v i = x i+1 x i 1 (Verle mehod)
Second-order ODEs Verle mehod is more numerically sable han Euler I is no self-saring: i needs boh and (x 0,v 0 ) (x 1,v 1 ) Accuracy can be arbirarily improved in his way a he cos of more saring poins: (x 2,v 2 ), ec. Forunaely, here is an updae rule mahemaically equivalen o Verle ha is self-saring: depends on x i+1 only x i+1 = x i + v i + 1 2 a i( ) 2 v i+1 = v i + 1 2 (a i+1 + a i ) (self-saring Verle)
Second-order ODEs Runge-Kua has he advanage of begin self-saring 4h order Runge-Kua for Newon s equaions of moion: k 1v = A(x i,v i, i ) k 1x = v i k 2v = A(x i + 1 2 k 1x,v i + 1 2 k 1v, i + 1 2 ) k 3v = A(x i + 1 2 k 2x,v i + 1 2 k 2v, i + 1 2 ) k 3x = v i + 1 2 k 2v k 4v = A(x i + k 3x,v i + k 3v, i + ) k 4x = v i + k 3x v i+1 = v i + 1 6 k 1v +2k 2v +2k 3v + k 4v x i+1 = x i + 1 6 k 1x +2k 2x +2k 3x + k 4x