{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 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "2D Input" 2 19 "" 0 1 255 0 0 1 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" 0 21 "" 0 1 0 0 0 1 0 0 0 0 2 0 0 0 0 1 }{CSTYLE "" -1 22 "" 0 1 0 0 0 0 1 2 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 35 "" 0 1 104 64 92 1 0 1 0 0 0 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 }{PSTYLE "Lis t Item" -1 14 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 3 3 1 0 1 0 2 2 14 5 }{PSTYLE "Bullet Item" -1 15 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 3 3 1 0 1 0 2 2 15 2 }{PSTYLE "Fixed Width" -1 17 1 {CSTYLE "" -1 -1 "Co urier" 1 10 0 0 0 1 2 2 2 2 2 2 3 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 17 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 257 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Maple Output" -1 258 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 3 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 65 "Klasszikus ODE megold \341si elj\341r\341sok pontoss\341g\341nak \366sszehasonlit\341sa" }} {PARA 256 "" 0 "" {TEXT -1 32 "a harmonikus oscill\341tor p\351ld\341j \341n" }}{PARA 257 "" 0 "" {TEXT -1 34 "Bartha Ferenc, SZTE, 2002. m \341rcius" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {MPLTEXT 0 21 22 "A differnci\341legyenlet:" }{TEXT -1 0 "" }{XPPEDIT 19 1 "equ:=diff(x(t),t)=v(t),diff(v(t),t)=-x(t):" "6 #>%$equG6$/-%%diffG6$-%\"xG6#%\"tGF--%\"vG6#F-/-F(6$-F/6#F-F-,$-F+6#F- !\"\"" }}}{EXCHG {PARA 0 "" 0 "" {MPLTEXT 0 21 16 "Kezd\366felt\351tel ek:" }{XPPEDIT 19 1 "ini:=x(0)=0,v(0)=1:" "6#>%$iniG6$/-%\"xG6#\"\"!F* /-%\"vG6#F*\"\"\"" }}}{EXCHG {PARA 0 "" 0 "" {MPLTEXT 0 21 20 "Analiti kus megold\341s:" }{XPPEDIT 19 1 "\nfun:= (t,k) -> sin(t):" "6#>%$funG f*6$%\"tG%\"kG7\"6$%)operatorG%&arrowG6\"-%$sinG6#F'F-F-F-" }}}{EXCHG {PARA 0 "" 0 "" {XPPEDIT 18 0 "Vizsg\341ljuk a megold\341sokat az x=[0 ,3*Pi]*intervallumon, 40 pontban;" "6$/*,%+Vizsg|\\yljukG\"\"\"%\"aGF& %-megold|\\ysokatGF&%#azGF&%\"xGF&*&7$\"\"!*&\"\"$F&%#PiGF&F&%.interva llumonGF&*&\"#SF&%(pontbanGF&" }{TEXT -1 1 "\n" }{MPLTEXT 1 0 62 "n:=4 0:dh:=(3*Pi-0.)/n:\nhpnt:=array(1..n+1,[seq(i*dh,i=0..n)]):" }}} {EXCHG {PARA 0 "" 0 "" {MPLTEXT 0 21 32 "V\341laszthat\363 klasszikus \+ formul\341k:" }}{PARA 15 "" 0 "" {TEXT 35 8 "foreuler" }{TEXT -1 8 " i s the " }{TEXT 22 13 "forward Euler" }{TEXT -1 34 " method specified b y the equation:" }}{PARA 17 "" 0 "wmitable" {TEXT -1 36 " Y[n+1] = Y [n] + h*f(t[n], Y[n]) " }}{PARA 15 "" 0 "" {TEXT 35 8 "heunform" } {TEXT -1 8 " is the " }{TEXT 22 4 "Heun" }{TEXT -1 106 " formula (also known as the trapezoidal rule, or the improved Euler method), as spec ified by the equation:" }}{PARA 17 "" 0 "wmitable" {TEXT -1 60 " Y[n +1] = Y[n] + (h/2)*(f(t[n],Y[n]) + f(t[n+1],Y[n+1])) " }}{PARA 15 "" 0 "" {TEXT 35 6 "impoly" }{TEXT -1 8 " is the " }{TEXT 22 16 "improved polygon" }{TEXT -1 80 " method (also known as the modified Euler meth od), as specified by the equation:" }}{PARA 17 "" 0 "wmitable" {TEXT -1 61 " Y[n+1] = Y[n] + h*(f(t[n]+h/2, Y[n]+(h/2)*f(t[n],Y[n]))) " }}{PARA 15 "" 0 "" {TEXT 35 3 "rk2" }{TEXT -1 8 " is the " }{TEXT 22 34 "second-order classical Runge-Kutta" }{TEXT -1 25 " method, as spec ified by:" }}{PARA 17 "" 0 "wmitable" {TEXT -1 102 " k1 = f(t[n] , Y[n]) \n k2 = f(t[n]+h, Y[n]+h*k1) \n Y[n+1] = Y[n] + (h/2)*(k1+k2) " }}{PARA 15 "" 0 "" {TEXT 35 3 "rk3" }{TEXT -1 8 " is the " }{TEXT 22 33 "third-order classical Runge-Kutta" }{TEXT -1 25 " method, as specified by:" }}{PARA 17 "" 0 "wmitable" {TEXT -1 168 " \+ k1 = f(t[n], Y[n]) \n k2 = f(t[n]+(h/2), Y[n ]+(h/2)*k1) \n k3 = f(t[n]+h, Y[n]+(2*h/3)*k2) \n Y[n+1] = Y [n] + (h/6)*(k1+4*k2+k3) " }}{PARA 15 "" 0 "" {TEXT 35 3 "rk4" } {TEXT -1 8 " is the " }{TEXT 22 34 "fourth-order classical Runge-Kutta " }{TEXT -1 25 " method, as specified by:" }}{PARA 17 "" 0 "wmitable" {TEXT -1 220 " k1 = f(t[n], Y[n]) \n k2 = f(t[n]+h/2, Y[n]+(h/2)*k1) \n k3 = f(t[n]+h/2, Y[n]+(h/2)*k 2) \n k4 = f(t[n]+h, Y[n]+h*k3) \n Y[n+1] = Y[n] + (h/6)*(k1+2*k2+2*k3+k4) " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }} {PARA 14 "" 0 "" {TEXT -1 32 "This is not to be confused with " } {TEXT 35 12 "method=rkf45" }{TEXT -1 15 ", which uses a " }{TEXT 22 46 "Fehlberg fourth-fifth order Runge-Kutta method" }{TEXT -1 1 "." }} {PARA 15 "" 0 "" {TEXT 35 8 "adambash" }{TEXT -1 8 " is the " }{TEXT 22 14 "Adams-Bashford" }{TEXT -1 48 " method (a \"predictor\" method), as specified by:" }}{PARA 17 "" 0 "wmitable" {TEXT -1 144 " Y[n+1] \+ = Y[n] + (h/24) * (55*f(t[n],Y[n]) - 59*f(t[n-1],Y[n-1]) \n \+ + 37*f(t[n-2],Y[n-2]) - 9*f(t[n-3],Y[n-3])) " }} {PARA 15 "" 0 "" {TEXT 35 9 "abmoulton" }{TEXT -1 8 " is the " }{TEXT 22 22 "Adams-Bashford-Moulton" }{TEXT -1 58 " method (a \"predictor-co rrector\" method), as specified by:" }}{PARA 17 "" 0 "wmitable" {TEXT -1 137 " Y[n+1] = Y[n] + (h/24) * (9*f(t[n+1],Y[n+1]) + 19*f(t[n],Y[ n]) \n - 5*f(t[n-1],Y[n-1]) + f(t[n-2],Y[ n-2]))" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "meth1:='foreuler';meth2:='abmoulton';h:=1/10;" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 220 " dsol1 := dsolve([equ,ini], type=numeric, m ethod=classical[meth1],\n output=hpnt,stepsize=h):\n pl1:=dsol1[2,1]: \n\n dsol2 := dsolve([equ,ini], type=numeric, method=classical[rk4],\n output=hpnt,stepsize=h):\n pl2:=dsol2[2,1]:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }{TEXT -1 0 "" }{MPLTEXT 1 0 81 "plot(\{[pl1[s,1],fu n(pl1[s,1],1.)-pl1[s,3]] $s=1..n+1\}, style=point,\ntitle=meth1);" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 81 "plot(\{[pl2[s,1],fun(pl2[s,1],1.)-p l2[s,3]] $s=1..n+1\}, style=point,\ntitle=meth2);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "8 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }