Upload
fernando-lucero-rojo
View
249
Download
0
Embed Size (px)
Citation preview
Integracion numerica
Los metodos Runge-Kutta
Contenido
• Metodos Runge-Kutta• Errores en la estimacion• Ejemplos
METODOS RUNGE-KUTTA
Carl David Tolmé Runge(1856-1927)
Martin Wilhelm Kutta(1867-1944)
Metodos Runge-Kutta
x
tti ti+1 =txi + h
( , )i if x t
xi solucion verdadera
Prediccion de Euler
h
1 ( , )i i i ix x f x t h
Error por truncado:2
1 ( ) ( )i ix x t O h
solucion verdadera
Metodos Runge-Kutta
x
tti ti+1 =txi + h
( , )i if x t
xi
Prediccion de Eulerxi+1
fi
1i i ix x h h
Los distintos metodos RK difieren en como estiman fi
Para Euler (RK de 1er-orden), fi = f(xi, ti)
solucion verdadera
RK de 2do-orden
x
x
ti ti+1 = xi + h
( , )i if x t
xifi
1i i ix x h
h
01 ( , )i i i ix x f x t h
01( , )i if x h t
01( , ) ( , )
2i i i i
i
f x t f x h t
promedio de las pendientes
Error por truncado:3
1 ( ) ( )i ix x t O h
solucion verdadera
El error es menor que en Euler, pero es necesario llamar a f(x,y) dos veces en cada paso
Algorithmo RK de 2do-orden
01 ( , )i i i ix x f x t h predictor:
corrector:0
11
( , ) ( , )
2i i i i
i i
f x t f x h tx x h
Metodo de Heun
01 ( , )i i i ix x f x t h predictor:
corrector:0
11
( , ) ( , )
2i i i i
i i
f x t f x h tx x h
iteration
Metodo RK de 4to orden
• En el metodo RK de 4to orden la estimacion de la pendiente es el promedio pesado de 4 estimados en el intervalo [ti, ti+1]:
– Uno al principio ( ti )
– Dos en la mitad (ti+ h/2), y
– Uno al final (tn+1 = tn+h)
Metodo RK de 4to orden
1i i ix x h 6/)22( 4321 kkkki
1 ( , )i ik f x t
2 1( / 2, / 2)i ik f x k h t h
3 2( / 2, / 2, )i ik f x k h t h
4 3( , , )i ik f x k h t h
4 estimadosde la pendiente
promedio pesado
Metodo RK de 4to orden
ti ti + h/2 ti + h
k1
k2
k3
k4
)( 4321 kk2k2k6
1
EJEMPLOS
Ejemplo, RK de 2do-orden dxxt
dt (0) 1x
solucion exacta:2exp( / 2)x t
tv=0:0.1:7;xv=exp(-0.5*tv.^2);
t=0; x=1; h=0.5; T=t; X=x; tf=6.5;while t<tf; x0=x+(-x*t)*h; x=x+(h/2)*((-x*t) + (-x0*(t+h))); t=t+h; T=[T t]; X=[X x];end
( , )f x t xt
( , )i if x t
01( , )i if x t h
01ix
exacta
El algoritmo es inestable porque h es demasiado grande !
0 1 2 3 4 5 6 70
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
x
y
h = 0.5
2nd-order RKExact
0 1 2 3 4 5 6 70
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
x
y
h = 0.2
2nd-order RKExact
Reduciendo h a 0.2 da un algoritmo estable y preciso
Ejemplo, RK de 4to-orden
sin( )
(0) 1
dxx t
dtx
En el intervalo 0,t
>> tt=0:0.01*pi:pi; xx=example2_f(tt);
>> [t,x]=RK4('example2_f',[0 pi],1,0.05*pi);
Ejemplo, RK de 4to-orden
Ejemplo, RK de 4to-orden
sin( ) ; 0 1dx
x t xdt
>> H=plot(t,x,'r-o',tt,xx);>> set(H,'LineWidth',3,'MarkerSize',12);
Fuentes
• Ferri Al, Numerical Solution to Differential equations, Lecture notes ME2016