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.

Meto<strong>de</strong> numerice 141<br />

> end if;<br />

> end proc:<br />

> x(0):=2:<br />

> x(t):=[seq(x(i,h),i=0..n)];<br />

x (t) := [2, 2.008211921, 2.036522685, 2.085215637,2.154778115,<br />

2.245906324, 2.359512308, 2.496733074,2.658941974,<br />

2.847762451, 3.065084284]<br />

> t:=[seq(t(i,h),i=0..n)];<br />

t := [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9,1.0]<br />

> sol_x(t):=exp(t)+exp(-t):<br />

> eval(sol_x(t),t=0);<br />

eval(sol_x(t),t=0.1); eval(sol_x(t),t=0.2);<br />

eval(sol_x(t),t=0.3); eval(sol_x(t),t=0.9);<br />

2<br />

2.010008336<br />

2.040133511<br />

2.090677029<br />

2.866172771<br />

Comparând aceste rezultate numerice cu cele obt¸inute cu metoda Euler<br />

¸si apoi cu cele obt¸inute <strong>prin</strong> calculul simbolic (din paragraful prece<strong>de</strong>nt),<br />

observǎm cǎ metoda lui Runge-Kutta are domeniul <strong>de</strong> convergent¸ǎ întreg<br />

intervalul consi<strong>de</strong>rat, solut¸iile obt¸inute <strong>prin</strong> rk4 fiind foarte apropiate <strong>de</strong> cele<br />

obt¸inute <strong>prin</strong> calcul simbolic.<br />

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

rk4 corespunzǎtoare sistemului <strong>de</strong> ecuat¸ii diferent¸iale (4.14) obt¸inem:<br />

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

> f1:=(t,x1,x2)->-x1(t)+8*x2(t):f2:=(t,x1,x2)->x1(t)+x2(t):<br />

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

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

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

k1:=f1(t(n-1,h),x1(n-1,h),x2(n-1,h));<br />

k2:=f1(t(n-1,h)+h/2,x1(n-1,h)+h*k1/2,x2(n-1,h)+h*k1/2);

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

Saved successfully!

Ooh no, something went wrong!