Вы находитесь на странице: 1из 49

Solución Numérica de

Ecuaciones Diferenciales
Ordinarias
Dr. Samir Al-Amer
Term 053
Traducido por Rosa Garrido J

SE301:Numerical Methods
Topic 8
Solution of ODE

SE301_Topic 8 (c)Al-Amer 2006 1


Ecuaciones Diferenciales Ordinarias
(EDO)
Método de la Serie de Taylor

 Ecuación Diferencial Ordinaria


 Método de la Serie de Taylor para resolver una
EDO

SE301_Topic 8 (c)Al-Amer 2006 2


EDO
Las Ecuaciones Diferenciales Ordinarias
involucran una o mas derivadas de funciones no
conocidas
dx(t )
 x(t )  et
dt
d 2 x(t ) dx(t )
2
5  2 x(t )  cos(t )
dt dt

La solución de una EDO es una función que


satisface la ecuaciones
SE301_Topic 8 (c)Al-Amer 2006 3
EDO
x(t )  cos(2t )
¿es la solución de la EDO única?
d 2 x(t )
2
 4 x(t )  0
dt
Todas las funciones de la forma x(t )  cos( 2t  c)
(Donde c es una constante real) son soluciones

SE301_Topic 8 (c)Al-Amer 2006 4


Unicidad de la Solución
Para especificar la unicidad de la solución de la
EDO de orden n necesitamos condiciones
iniciales.

2
d y ( x)
 4 y ( x)  0
dt 2
y (0)  a
y (0)  b

SE301_Topic 8 (c)Al-Amer 2006 5


Método de la Serie de Taylor
dy ( x)
Dado  f ( y, x), y (a )  y a
dx
Expansión de la Serie de Taylor de y(x)
dy
y (a  h)  y (a )  h  h.o.t  y (a )  h f ( y (a ), a )
dx
Similarmen te
y (a  2h)  y (a  h)  h f ( y (a  h), a  h)
Usamos fórmulas similares para calcular y (a  3h), y (a  4h),....

SE301_Topic 8 (c)Al-Amer 2006 6


Ejemplo
dy
Solve  f ( y, x) , y (0)  ya use h  0.01
dx

y(0)
y(h)

SE301_Topic 8 (c)Al-Amer 2006 7


Ejemplo
dy
Re solver  1  x 2 , y (1)  4 use h  0.01
dx

y (a  h)  y (a)  h f ( y (a), a)
y (1)  4
y (1.01)  4  0.01(1  (1) 2 )  3.98

y (1.02)  3.98  0.01 1  1.01  3.9598
2

y (1.03)  3.9598  0.011  1.02   3.9394 2

SE301_Topic 8 (c)Al-Amer 2006 8


Ejemplo
dx(t )
Re solver  1  t 2 , x(1)  4 use h  0.01
dt

SE301_Topic 8 (c)Al-Amer 2006 9


Método de Euler
El Método de Euler  Método de la serie de Taylor
dy ( x)
Dado  f ( y, x), y (a )  y a
dx
Solución :
y (a  h)  y (a)  h f ( y (a), a)
y (a  2h)  y (a  h)  h f ( y (a  h), a  h)
y (a  3h)  y (a  2h)  h f ( y (a  h), a  2h)

SE301_Topic 8 (c)Al-Amer 2006 10


Tipos de Errores
Tipos de Errores:
 Error Local de Truncación:
error causado por el uso de la serie de
Taylor truncada para calcular x(t+h).
 Error de Redondeo:
error causado por el número finito de bits
usado en la representación de los numéros.
Este error puede ser acumulado y
magnificado en los pasos sucesivos.

SE301_Topic 8 (c)Al-Amer 2006 11


Ejemplo 2
dx(t )
Re solver  2 x(t )  1, x(0)  1 use h  0.01
dt

x(a  h)  x(a )  h f (a, x(a ))


f ( x)  ?
x(0.01)  ?
x(0.02)  ?
x(0.03)  ?
x(0.04)  ?
SE301_Topic 8 (c)Al-Amer 2006 12
Ejemplo 2
dx(t )
Solve  2 x(t )  1, x(0)  1 use h  0.01
dt

x(a  h)  x(a )  h f (a, x(a ))


f (t , x)  1  2 x(t )
x(0.01)  1  .01(1  2(1))  1  .01  .99
x(0.02)  0.99  0.01(1  2(0.99))  0.9802
x(0.03)  0.9706
x(0.04)  0.9612
SE301_Topic 8 (c)Al-Amer 2006 13
Método de Euler
Modificado
Revisión del Métoo de Euler Heun’s
Método de Heum
Método del Medio punto
Método de Runge-Kutta

SE301_Topic 8 (c)Al-Amer 2006 14


Titulos
 Método de Euler
 Heun’s Predictor Corrector
 Método de Medio punto (Midpoint)
 Comparación

SE301_Topic 8 (c)Al-Amer 2006 15


Método de Euler
Problem a Método de Euler
y ( x)  f ( x, y ) y 0  y ( x0 )
y ( x0 )  y 0 y i 1  y i  h f ( xi , y i )
for i  1,2,...

2
Error Local de Truncación O(h )
Error Global de Truncación O(h )
SE301_Topic 8 (c)Al-Amer 2006 16
Método del Predictor-Corrector de Heun
Problema Máetodo de Heum
y ( x)  f ( x, y ) y 0  y ( x0 )
y ( x0 )  y 0 Predictor : y ik1  y i  h f ( xi , y i )

Corrector : y k 1
i 1  yi 
h
2

f ( xi , y i )  f ( xi 1 , y ik1 ) 

Error Local Truncación O(h 3 )


Error Global Truncation O(h 2 )

SE301_Topic 8 (c)Al-Amer 2006 17


Método del Medio punto
Problema Método del Medio Punto
y ( x)  f ( x, y ) y 0  y ( x0 )
h
y ( x0 )  y 0 y 1  y i  f ( xi , y i )
i 2
2

y i 1  y i  h f ( x 1 ,y 1 )
i i
2 2

Local Truncation Error O(h 3 )


Global Truncation Error O(h 2 )
SE301_Topic 8 (c)Al-Amer 2006 18
Métodos Runge-Kutta

Métodos de Runge Kutta

SE301_Topic 8 (c)Al-Amer 2006 19


Método de Runge Kutta
Runge Kutta de Segundo Orden
K 1  h f (t , x)
K 2  h f (t   h, x   K 1 )
x(t  h)  x(t )  w1 K 1  w2 K 2
Problema :
Encontrar  ,  , w1 , w2
tal que x(t  h) es una poisble aproximaci ón.
SE301_Topic 8 (c)Al-Amer 2006 20
Serie de Taylor en dos
Variables
El método de la serie de Taylor en dos variables
es usado para probar la fórmula de Runge Kutta

SE301_Topic 8 (c)Al-Amer 2006 21


Serie de Taylor en una Variable

Expansión en la serie de Taylor de f(x)


n 1 i n
h (i ) h
f ( x  h)   f ( x )  (n)
f (x)
i  0 i! n!

Aproximación Error

donde x esta entre x y x  h


SE301_Topic 8 (c)Al-Amer 2006 22
Serie de Taylor en una variable

Define
i
 d 
i
i d f ( x)
 h  f ( x)  h  f ( x) h
(i ) i

 dx 
i
dx
La expansión de la serie de Taylor de f(x)
n 1 i n
1 d  1 d 
f ( x  h)    h  f ( x )   h  f ( x )
i  0 i!  dx  n!  dx 
x esta entre x y x  h
SE301_Topic 8 (c)Al-Amer 2006 23
Definiciones

   
i i
f
 h  f ( x , y )  h i

 x  x i
0
   
 h k  f ( x, y )  f ( x, y )
 x y 
1
     f ( x, y)  f ( x, y )
 h k  f ( x, y )  h k
 x y  x y
2
     2
f ( x , y )  2
f ( x , y )  2
f ( x, y)
 h k  f ( x, y )  h2  2 h k  k 2

 x y  x 2 xy y 2

SE301_Topic 8 (c)Al-Amer 2006 24


Serie de Taylor en Dos Variables

La expansión de la serie de Taylor de f(x, y)


i n
n 1
1    1   
f ( x  h, y  k )    h  k  f ( x, y )   h  k  f ( x , y )
i 0 i!  x y  n!  x y 
aproximación error
( x , y ) esta en la linea entre ( x, y ) y ( x  h, y  k )
y+k

x x+h
SE301_Topic 8 (c)Al-Amer 2006 25
Expansión de la Serie de Taylor
f(x, y)  ( x  1)( x  y  2) 2

Expansión en la Serie de Taylor Centro de expansión( 0,0)


0
   
 h  k  f ( x, y ) 4
 x y 
( 0.0 )
1
   
 h  k  f ( x, y )  h fx  k fy
 x y 
( 0.0 )
( 0, 0 )

SE301_Topic 8 (c)Al-Amer 2006 26


Método de Runge-Kutta
Runge Kutta de Segundo Orden
K 1  h f (t , x)
K 2  h f (t   h, x   K 1 )
x(t  h)  x(t )  w1 K 1  w2 K 2
Problema :
Encontrar  ,  , w1 , w2
tal que x(t  h) es una posible aproximaci ón.
SE301_Topic 8 (c)Al-Amer 2006 27
Método de Runge-Kutta
Problema : Encontrar  ,  , w1 , w 2
relacionar tantos términos como sea posible.

h2 h3
x (t  h)  x (t )  hx ' (t )  x ' ' (t )  x ' ' ' (t )  ...
2 6
x (t  h)  x (t )  w1h f (t , x )  w 2 hf (t   h, x   h f (t , x ))

  
2
1
f (t   h, x   h f )  f   h f t   h f x    h   h  f (t , x )
2 t x 
x (t  h)  x (t )  w1  w 2 h f (t , x )   w 2 h2 f t   w 2 h2 f f x  O (h3 )
SE301_Topic 8 (c)Al-Amer 2006 28
Método de Runge-Kutta
h2 h3
x (t  h)  x (t )  hx ' (t )  x ' ' (t )  x ' ' ' (t )  ...
2 6

x (t  h)  x (t )  w1  w 2 h f (t , x )   w 2 h2 f t   w 2 h2 f f x  O ( h3 )

 w1  w2  1,  w2  0.5,  w2  0.5
Una posible solución
w1  0.5, w2  0.5,   1,  1

SE301_Topic 8 (c)Al-Amer 2006 29


Método de Runge-Kutta- orden 2

K1  h f (t , x )
K 2  h f (t  h, x  K1 )

x (t  h)  x (t )   K1  K 2 
1
2

SE301_Topic 8 (c)Al-Amer 2006 30


Método de Runge-Kutta
Fórmula alternativa

Runge Kutta de segundo Orden


F1  f (t , x )
F2  f (t  h, x  hF1 )

x (t  h)  x (t )  F1  F2 
h
2

SE301_Topic 8 (c)Al-Amer 2006 31


Método de Runge-Kutta

 w1  w2  1,  w2  0.5,  w2  0.5
otra solución
Escoja  cualquier - número no cero
1 1
   , w1  1  , w2 
2 2
Fórumulas de Segundo Orden (seleccion ar   0)
K 1  h f (t , x)
K 2  h f (t   h, x   K 1 )
 1  1
x(t  h)  x(t )  1   F1  F2
 2  2
SE301_Topic 8 (c)Al-Amer 2006 32
Método de Runge Kutta de orden 2
Ejemplo

Resolver la Edo para x(1.02) usando RK2


x (t )  1  x 2 (t )  t 3 , x (1)  4, h  0.01

STEP 1 :
K1  h f (t , x )  0.01(1  x 2  t 3 )  0.18
K 2  h f (t  h, x  K1 )  0.01(1  ( x  0.18) 2  (t  .01)3 )  0.1692

x (1  0.01)  x (1)   K1  K 2   4  (0.18  0.1692)  3.8254


1 1
2 2

SE301_Topic 8 (c)Al-Amer 2006 33


Second order Runge-Kutta Method
Ejemplo

STEP 2

K1  h f (t , x)  0.01(1  x 2  t 3 )  0.1666
K 2  h f (t  h, x  K1 )  0.01(1  ( x  0.1666) 2  (t  .01)3 )  0.1545

x(1.01  0.01)  x(1.01)  K1  K 2 


1
2
1
 3.8254  (0.1666  0.1545)  3.6648
2

SE301_Topic 8 (c)Al-Amer 2006 34


SE301_Topic 8 (c)Al-Amer 2006 35
Método de Runge-Kutta de cuarto
Orden

K1  h f (t , x )
1 1
K 2  h f (t  h, x  K1 )
2 2
1 1
K 3  h f (t  h, x  K 2 )
2 2
K 4  h f (t  h, x  K 3 )

x (t  h)  x (t )   K1  2 K 2  2 K 3  K 4 
1
6
SE301_Topic 8 (c)Al-Amer 2006 36
Ejemplo
Runge Kutta de cuarto orden

dy
 1 y  x 2

dx
y (0)  0.5
h  0.2
Calcule y (0.2) e y (0.4)
SE301_Topic 8 (c)Al-Amer 2006 37
Ejemplo
Método de Runge-Kutta de Cuarto Orden
Iteración 1 de RK4 ( x  0, y  0.5)
K 1  h f ( x, y )  0.3000
1 1
K 2  h f ( x  h, y  K 1 )  0.3280
2 2
1 1
K 3  h f ( x  h, y  K 2 )  0.3308
2 2
K 4  h f ( x  h, y  K 3 )  0.3482

y ( x  h)  y ( x)  K 1  2 K 2  2 K 3  K 4   0.8276
1
6
SE301_Topic 8 (c)Al-Amer 2006 38
EDO de mayor Orden
High order EDO
Systems of High order EDO
Procedure
Examples

SE301_Topic 8 (c)Al-Amer 2006 39


EDO de alto Orden
 Métodos tratados anteriormente tales
como Euler ,Runge-Kutta,…son usados
para resolver ecuaciones diferenciales
ordinarias de primer orden
 Como resolvemos las EDO de segundo
orden, o mas alto orden?

SE301_Topic 8 (c)Al-Amer 2006 40


EDO de mayor orden
 Alcance: Convertir las ecuaciones diferenciales
de más alto orden en un sistema de EDOs de
primer orden


X (t )  F (t , X )

SE301_Topic 8 (c)Al-Amer 2006 41


Ejemplo de la conversión de una EDO
de alto orden en un sist. de EDOs
Convertir
x  3 x  6 x  1
x (0)  1; x(0)  4
a un sistema de primer orden de EDOs

1. Seleccione un nuevo conjunto de variables


z1  x Un grado menos
z 2  x que la mas alta
derivada
SE301_Topic 8 (c)Al-Amer 2006 42
Ejemplo of conversión de una EDO de alto
orden a un sist. de EDOs de primer orden
ant. nuevo Cond. Ecuación
var. var . inicial
x z1 4 z1  z 2
x z2 1 z2  1  3z 2  6 z1

 z1   z2   4
 z   1  3z  6 z  , Z (0)  1
 2  2 1  
SE301_Topic 8 (c)Al-Amer 2006 43
Ejemplo of conversión de una EDO de alto
orden en un sist. de primer orden de EDOs
Convertir
Un grado menos
x  2 x  7 x  8 x  0 que la mas grande
x(0)  9, x (0)  1; x(0)  4 derivada

1. Selecciona r un nuevo conjunto de variables


z1  x
z 2  x
z 3  x
SE301_Topic 8 (c)Al-Amer 2006 44
Ejemplo de la conversión de una EDO
de alto orden en un sist. de EDOs
ant. nueva Cond. Ecuación
var. var . inicial
x z1 4 z1  z 2
x z2 1 z2  z3
x z3 9 z3  2 z3  7 z 2  8 z1
 z1   z2   4
 z      
 2  z3  , Z ( 0)   1 
 z3    2 z3  7 z 2  8 z1  9 
SE301_Topic 8 (c)Al-Amer 2006 45
Ejemplo de la conversión de una EDO
de alto orden en un sist. de EDOs
Convertir Un grado menos
x  5 x  2 x  8 y  0 que la mas grande
derivada
y  2 xy  x  2
x (0)  4; x (0)  2; x(0)  9; y (0)  1; y (0)  3
1. Seleccionar un nuevo conjunto de variables
z1  x Un grado menos
que la mas grande
z 2  x derivada
z3  x
z4  y
z5  y (c)Al-Amer 2006 46
SE301_Topic 8
Ejemplo de la conversión de una EDO
de alto orden en un sist. de EDOs
old new Initial Equation
name name cond.
x z1 4 z1  z2
x z2 2 z2  z3
x z3 9 z3  5 z3  2 z2  8 z4
y z4 1 z4  z5
y z5 3 z5  2  z2  2 z1z4
SE301_Topic 8 (c)Al-Amer 2006 47
Solución de una EDO de segundo orden
 Solve the equation using Euler method. Use h=0.1
x  2 x  8 x  2
x(0)  1; x (0)  2
Select a new set of variable z1  x, z 2  x
The second order equation is expressed as

  1  
z z   1 
Z  F (Z )      2
 , Z (0)   
 z2  2  2 z 2  8 z1    2

SE301_Topic 8 (c)Al-Amer 2006 48


Solución de una EDO de segundo orden
 z2  1
F (Z )    , Z (0)   , h  0.1
2  2 z2  8 z1    2
Z (0  0.1)  Z (0)  hF ( Z (0))
1  2   0.8 
    0.1   
  2 2  2(2)  8(1)  2.2
Z (0.2)  Z (0.1)  hF ( Z (0.1))
 0.8    2.2   0.58 
   0.1   
  2.2   2  2( 2 .2)  8( 0.8)    2.2 
SE301_Topic 8 (c)Al-Amer 2006 49

Вам также может понравиться