Está en la página 1de 18

UNIVERSIDAD PERUANA UNIN FACULTAD DE INGENIERA Y ARQUITECTURA INGENIERA DE SISTEMAS CURSO: MTODOS NUMRICOS

Alumno: Jos Manuel Limachi Chvez

Introduccin
Cabe destacar que el mtodo de Runge kutta fue desarrollado por los matemticos C. Runge y M. W. Kutta. Este mtodo es tambin llamado Runge-Kutta explcito. Es un mtodo iterativo tanto implcito como explcito para aproximar las soluciones de ecuaciones diferenciales ordinarias. El mtodo cuarto orden se puede utilizar para calcular soluciones aproximadas.

Mtodo de Runge Kutta El mtodo de Runge-Kutta es un mtodo genrico de resolucin numrica de ecuaciones diferenciales. Se trata de un mtodo por etapas que tiene la siguiente expresin genrica:

donde: i = 1,..., e con aij,bi,ci constantes propias del esquema numrico. Los esquemas Runge-Kutta pueden ser explcitos o implcitos dependiendo de las constantes aij del esquema. Si esta matriz es triangular inferior con todos los elementos de la diagonal principal iguales a cero; es decir, aij = 0 para j = i,..., e, los esquemas son explcitos.

Ejemplo:
Esquema Runge-Kutta de dos etapas, una en t = tn y otra en t = tn + tn. F (u, t) en la primera etapa es:

y para estimar F (u, t) en t = tn + Euler

tn usamos un esquema

Con estos valores de F introducidos en la ecuacin nos queda la expresin:

Las constantes propias de este esquema son: b1 = b2 = 1 / 2;a21 = 1;c2 = 1. Existen variantes del mtodo de Runge-Kutta clsico, tambin llamado Runge-Kutta explcito, tales como la versin implcita del procedimiento o las parejas de mtodos Runge-Kutta (o mtodos Runge-Kutta-Fehlberg). Este ltimo consiste en ir aproximando la solucin de la ecuacin mediante dos algoritmos Runge-Kutta de rdenes diferentes, para as mantener el error acotado y hacer una buena eleccin de paso.

Mtodo de Runge-Kutta (de cuarto orden): Los llamados mtodos de Runge-Kutta son una serie de algoritmos para calcular aproximaciones numricas del valor de la solucin de:

dy ! f ( x, y ) ; y ( x0 ) ! y0 dx
En puntos de la forma siguiente:

x1 ! x0  h ; x2 ! x1  h ; etc
con muy buena precisin, sin que, para ello, sea necesario que los h sean muy pequeos. El procedimiento consta de los siguientes pasos: Para calcular un valor aproximado de la solucin y1 en el punto

x1 = x0 + h, se calculan los siguientes nmeros:

k1 ! h f ( x0 , y 0 )
h k1 k2 ! h f (x0  , y0  ) 2 2 h k2 k3 ! h f (x0  , y0  ) 2 2

k4 ! h f (x0 h, y0 k3)


1 K0 ! (k1 2k2 2k3 k4) 6
y entonces se toma:

y1 ! y 0  K 0

Del mismo modo, se calcula el valor aproximado de la solucin, y2, en el punto x2 = x1 + h:

k 1 ! h f ( x1 , y1 )

h k1 k2 ! h f (x1  , y1  ) 2 2 h k2 k 3 ! h f ( x1  , y1  ) 2 2

k4 ! h f (x1  h, y1  k3 )
0

1 ! (k1  2k2  2k3  k4 ) 6


Y as, sucesivamente

y 2 ! y1  K 0

Ejemplo 1 Utilizar el mtodo de Runge-Kutta con el problema siguiente para calcular la solucin aproximada en x = 0.2 y x =0.4:

dy ! 2x  y ; y(0) ! 1 dx
h = 0.2:

x1 ! x0 h!00.2!0.2

k1 ! h f ( x0 , y0 ) ! 0 .2 ( 2 v 0  1) ! 0.2
h k1 k 2 ! h f ( x0  , y0  ) ! 0 .2 f ( 0  0 .1, 1  0 .1) 2 2

k 2 ! 0 . 2 2 v 0 . 1  1 . 1 ! 0 . 26

k2 h k3 ! h f ( x0  , y0  ) ! 0 . 2 f ( 0 . 1, 1 . 13 ) 2 2

k 3 ! 0 . 2 2 v 0 . 1  1 . 13 ! 0 . 266

k 4 ! h f ( x0  h, y0  k3 )

! 0 . 2 f ( 0 . 2 , 1 . 266 )

k 4 ! 0 . 2 2 v 0 . 2  1 . 266 ! 0 . 3332
0

1 ! ( k 1  2 k 2  2 k 3  k 4 ) ! 0 . 2642 6
0

y1 ! y 0  K

! 1 . 2642

x2 ! x1  h ! 0.20.2 ! 0.4

k 1 ! h f ( x 1 , y 1 ) ! 0.2 (2 v 0.2  1.2642) ! 0.33284 h k1 k 2 ! h f ( x1  , y1  ) ! 0 . 2 f ( 0 .3, 1 .43062 ) ! 0 .40612 2 2 h k2 k 3 ! h f ( x1  , y 1  ) ! 0 .2 f ( 0 .3, 1 .46726 ) ! 0 .41345
2 2

k4 ! h f ( x1  h, y1  k3 ) ! 0 .2 f ( 0 .4 , 1 .67765 ) ! 0 .49553
1 K 0 ! ( k1  2 k 2  2 k 3  k 4 ) ! 0.41125 6

y 2 ! y1  K 0 ! 1 . 2642  0 . 41125 ! 1 . 67545

import java.io.BufferedReader; import java.io.InputStreamReader; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author JOSE MANUEL */ public class RK { public static double func(double x, double y) { return //-2*x^3+12*x^2-20*x+8.5; -2*Math.pow(x, 3)+12*Math.pow(x, 2)-20*x+8.5; } public static void reportar(double x, double y, int i) { System.out.println("\t\t" +i +"\t\t" +x +"\t\t" +y ); }

public static int menu() { int opc=0; do { BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); try { System.out.println("SELECCIONE OPCION"); System.out.println("================="); System.out.println("1.Metodo de Runge Kutta"); System.out.println("2.Salir"); System.out.print("Opcion:");opc=Integer.parseInt(br.readLine()); }catch(Exception e){e.getMessage();}

}while(opc<1||opc>2); return opc; }

public static void Kutta(){ double x0,y0,xf,yf,h,k1,k2,k3,k4; int n,i; System.out.println("Metodo de Runge Kutta"); System.out.println("---------------------"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { System.out.print("Ingrese el valor de x0: ");x0=Double.parseDouble(br.readLine()); System.out.print("Ingrese el valor de y0: ");y0=Double.parseDouble(br.readLine()); System.out.print("Ingrese el valor de xf: ");xf=Double.parseDouble(br.readLine()); do{ System.out.print("Ingrese el numero de subintervalos a emplear: ");n=Integer.parseInt(br.readLine()); }while(n<=0); h=(xf-x0)/n; System.out.println(""); System.out.println("\t\t" +"I" +"\t\t" +"Xi" +"\t\t" +"Yi" ); System.out.println("\t\t" +"-" +"\t\t" +"-" +"\t\t" +"-" );

for(i=1;i<=n;i++) { k1=func(x0,y0); k2=func(x0+h/2,y0+h*k1/2); k3=func(x0+h/2,y0+h*k2/2); k4=func(x0+h,y0+h*k3); y0=y0+(k1+2*k2+2*k3+k4)*h/6; x0=x0+h; reportar(x0,y0,i); } System.out.println("El valor de Yf: " +y0);

}catch(Exception e){e.printStackTrace();}

} public static void terminar() {System.out.println("Gracias por usar el programa"); }

public static void main (String[]args) {int opc; do { opc=menu(); switch(opc) {case 1: Kutta(); break; case 2: terminar();break; } } while(opc!=2); }

Conclusi n
El mtodo de runge kutta es empleado para la resolucin de ecuaciones diferenciales. Los mtodos Runge-Kutta o mtodos Runge-KuttaFehlberg. Consiste en ir aproximando la solucin de la ecuacin mediante dos algoritmos Runge-Kutta de rdenes diferentes, para as mantener el error acotado y hacer una buena eleccin de paso. El mtodo de Runge Kutta de cuarto orden es una serie de algoritmos para calcular aproximaciones numricas.

También podría gustarte