06.03.2013 Views

Capitolul 1 Ecuatii diferentiale de ordinul ˆıntâi rezolvabile prin ...

Capitolul 1 Ecuatii diferentiale de ordinul ˆıntâi rezolvabile prin ...

Capitolul 1 Ecuatii diferentiale de ordinul ˆıntâi rezolvabile prin ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

140 CAPITOLUL 4<br />

rk4 ¸si repectiv cea <strong>de</strong> <strong>ordinul</strong> al cincilea Fehlberg-Runge-Kutta rkf45.<br />

Fǎrǎ a intra în <strong>de</strong>talii privitoare la convergent¸ǎ, redǎm aici procedura <strong>de</strong><br />

iterat¸ie a meto<strong>de</strong>i Runge-Kutta standard rk4:<br />

un<strong>de</strong><br />

ti+1 = ti + h<br />

X i+1 = X i + h · mR−K<br />

mR−K = 1<br />

6 (m1 + 2m2 + 2m3 + m4)<br />

m1 = F(ti, X i )<br />

m2 = F(ti + h/2, X i + h/2 · m1)<br />

m3 = F(ti + h/2, X i + h/2 · m2)<br />

m4 = F(ti + h, X i + h · m3).<br />

Aceastǎ procedurǎ <strong>de</strong> trecere <strong>de</strong> la (ti, X i ) la (ti+1, X i+1 ) este u¸sor <strong>de</strong><br />

programat.<br />

Pentru exemplificare vom consi<strong>de</strong>ra acelea¸si exemple ca ¸si in cazul meto<strong>de</strong>i<br />

Euler, dupǎ care vom compara rezultatele numerice obt¸inute.<br />

Programând în Maple procedura <strong>de</strong> iterat¸ie Runge-Kutta standard rk4<br />

corespunzǎtoare ecuat¸iei diferent¸iale (4.13) obt¸inem:<br />

> h:=0.1: n:=10:<br />

> f:=(t,x)->-x(t)+2*exp(t):<br />

> t:=(n,h)->n*h:<br />

> x:=proc(n,h) local k1,k2,k3,k4;<br />

> if n=0 then x(0) else<br />

k1:=f(t(n-1,h),x(n-1,h));<br />

k2:=f(t(n-1,h)+h/2,x(n-1,h)+h*k1/2);<br />

k3:=f(t(n-1,h)+h/2,x(n-1,h)+h*k2/2);<br />

k4:=f(t(n-1,h)+h/2,x(n-1,h)+h*k3);<br />

x(n-1,h)+h/6*(k1+2*k2+2*k3+k4)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!