{VERSION 5 0 "IBM INTEL NT" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 550 "In the previous worksheet, we examined the classical methods o f Euler and Runge-Kutta. In this worksheet, we look at the \"Workhors e\" of the numerical solvers, Runge-Kutta-Fehlberg orders 4 and 5. Th e idea is that we get two solutions, Runge-Kutta order 4 and Runge-Kut ta order 5. We use these two algorithms to give us an estimate of the current error. If this value is too large, we cut the stepsize. If \+ the error is small, we increase the stepsize. This way, we do not hav e to give the algorithm a stepsize, it tries to compute it on its own. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "de:=diff(y(t),t)=t+y(t)-3;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 148 "Here, we'll use dsolve, give the range \+ of possible t values, and output a generic procedure to be used later \+ in plotting or evaluating the solution:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "Soln1:=dsolve(\{de,y(0 )=1\},numeric,method=rkf45,range=0..1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 92 "Here we will have dsolve \+ output the value of the solution at some predefined values of time:" } }{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 82 "Soln2:=dsolve(\{de,y(0)=1\},numeric,method=rkf45,output=array([0 ,0.1,0.2,0.3,0.4]));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 35 "We can plot the numerical solution:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "wit h(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "odeplot(Soln1, 0..1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "1 0 0 " 8 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }