integracion numerica los metodos runge-kutta. contenido metodos runge-kutta errores en la estimacion...

19
Integracion numerica Los metodos Runge-Kutta

Upload: fernando-lucero-rojo

Post on 02-Feb-2016

257 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

Integracion numerica

Los metodos Runge-Kutta

Page 2: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

Contenido

• Metodos Runge-Kutta• Errores en la estimacion• Ejemplos

Page 3: 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)

Page 4: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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

Page 5: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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

Page 6: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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

Page 7: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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

Page 8: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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

Page 9: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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)

Page 10: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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

Page 11: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

Metodo RK de 4to orden

ti ti + h/2 ti + h

k1

k2

k3

k4

)( 4321 kk2k2k6

1

Page 12: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

EJEMPLOS

Page 13: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion 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

Page 14: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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

Page 15: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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

Page 16: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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);

Page 17: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

Ejemplo, RK de 4to-orden

Page 18: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

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);

Page 19: Integracion numerica Los metodos Runge-Kutta. Contenido Metodos Runge-Kutta Errores en la estimacion Ejemplos

Fuentes

• Ferri Al, Numerical Solution to Differential equations, Lecture notes ME2016