umerical Solutio o Ordiar Dieretial Equatios Cosider te st order ordiar dieretial equatio ODE d. d Te iitial coditio ca be tae as. Te we could use a Talor series about ad obtai te complete solutio or......!!! Sice ad te we ca id te irst two terms. For te secod derivative d d d d Similarl te tird derivative is. d. d I we trucate at te tird derivative Error!! ad iv 4 Error 4! were.
Euler s Metod Tae te Talor series to st order ad let te iterval te Te error or a time step te local error is O O. Te.. Te global error ater ma steps is were were were. Eample: d d Te eact solutio ca be oud rom d. d Let d c p were c c or d c r r Ce. Te rce Ce or all r or r ad c Ce. Sice te rigt ad side is liear i tr p A B. Te d p d p A ad p becomes A A B wic must old or all. Hece d d A ad B=- maig p ad sice c p te Ce. But @ or C ad C. Maig te complete solutio e.
Usig Euler s metod ad taig.... sice. I geeral ; eact......4.4.48.46.6.64.67 4.8.848.866 5..8. For te error Euler 5. 8 Eact 5. ca be deied as Re lative Error Euler Euler Eact Eact. %.9 Te results plot as It would be better to use te slope at te begiig ad ed o te icremet e.g. te average at eac ed ad altoug we do t ow te slope at te ed we ca approimate it.
4 Modiied Euler Metod Let. Te a approimatio or at te ed o te icremet is ~ ad a estimate or te slope at te ed o te icremet is ~ ~. We ca ow set ~. Te error ca be oud rom O ad sice O O or O. Hece te local error is O ad te global error is O. Aoter wa to write our results is Te previous eample ow ca iclude modiied Euler euler modiied eact.......4.4.4.48.46.46.6.64.67.67 4.8.848.866.866 5..8.4. wic is muc better.
5 Ruge-utta Metods Te modiied Euler metod is actuall a two step secod order Ruge-utta algoritm. Tese metods ca be readil eteded to eigt ad eve tet order. Te derivatios ollow te same procedure. Assume or te secod order metod were a b ad. Te parameters a b ad are oud b comparig to a Talor series epasio. Recall. But. Sice Usig a b or Comparig to te Talor series a b a b b b. Te a b b b wic is tree equatios i our uows. Hece we ca pic or te ourt equatio a equatio tat is coveiet. For eample we ca tae or Modiied Euler is a / b / ad / a b ad /. a b / ad.
6 Fourt Order Ruge-utta For ourt order Ruge-utta te estimates or te cages are 4 ad te updated value or is oud rom 4 6. ote tat all o te algoritms preseted are or irst order equatios wit ol oe depedet variable. Tese ca be readil eteded to sstems o iger order dieretial equatios. For tose cases please see page 7.
7 Higer Order Dieretial Equatios Cosider...... d d ad let te vector be deied as...... were... wic is ow a vector irst order equatio ad te irst order rules ca be applied to a sstem o irst order equatios. Sstems o First Order Equatios Let F Euler: F Modiied Euler: were F F Ruge-utta 4 t order: 4 6 were
8 4 F F F F
9 Problem Te equatio or a pedulum wit a mass m at te ed o a rod o egligible mass wit legt L is ml mglsi. For te iitial coditios tae @ t ad @ t were d d is te agle rom te vertical ad. dt dt Let ow let g t L. Te equatio becomes d p te sice d d si. d d dp dp d d d d d dp p d Te equatio ca be writte dp p si d ad itegratig p cos E costat. d Tis is te coservatio o eerg. Te iitial coditio is p @ d ece E cos or d cos cos d is also te goverig dieretial equatio. Itegrate te equatio o motio subject to te iitial coditios / @ ad @ usig Euler modiied Euler ad Ruge-utta. Use te epressio or te eerg to cec te accurac o our itegratio. Itegrate or oequarter o a ccle ad te determie te period or a complete ccle.