Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Reporte Final Unidad VI
Reporte Final Unidad VI
d2y
4y 0
dx 2
dy
2 xy
dx
x2
z
z
2
3 xy 4 z sec y 0
x
y
Las dos primeras ecuaciones contienen derivadas ordinarias y por la forma en que estn escritas vemos que
y = f(x); la tercera contiene derivadas parciales y podemos ver que z = f(x, y). El orden de una ecuacin
diferencial es el mximo orden de las derivadas que contiene
En esta unidad desarrollaremos mtodos numricos para encontrar la solucin de ecuaciones diferenciales
ordinarias a partir de valores iniciales.
Un problema de valor inicial consiste en una ecuacin diferencial, y en una condicin que debe satisfacer la
solucin (o varias condiciones que se refieren al mismo valor de x, si la ecuacin es de orden superior.)
dy
f x, y ,
dx
y0 = y(x0)
1
1
f xi h 2 f xi h3 ...
2!
3!
f xi 1 f xi f xi h
donde h = xi+1 - xi.
f(xi)
1
f xi h 2
2!
f (xi)
+ (o) h2
yi+1 = yi+ h
101
f(x)
yi+1 = yi + h
yi+1
pendiente =
xi
xi+1
tamao de paso
h= xi+1 - xi
Figura 6.1 Mtodo de un solo paso
6.2.1.1 Mtodo de Euler
La primera derivada proporciona una aproximacin directa a la pendiente en xi
= f (xi, yi)
donde f(xi, yi) es la ecuacin diferencial evaluada en (xi, yi)
yi+1 = yi+ f (xi, yi) h
A esta frmula se le conoce como mtodo de Euler, o mtodo de Euler-Cauchy o de pendiente puntual.
Ejemplo 6.1
Hallar el valor de f(x) en x =2, s y(0) = 1
dy
yx 2 y
dx
Analticamente
dy
yx 2 y y x 2 1
dx
dy
y x 2 1
dx
dy
x 2 1 dx
y
ln y
x3
xC
3
y Ae
x3
x
3
d ln y x 2 1
ye
x3
x
3
102
Numricamente
Por el mtodo de Euler, usando h = 0.5, y(0) = 1.
Ecuacin del mtodo
yi+1 = yi+ f (xi, yi) h
xi = 0
yi = 1
f (xi, yi) = yi (xi2 - 1)
f (0, 1) = 1 (02 - 1) = -1
xi = 1
yi = 0.3125
f (xi, yi) = f (1, 0.3125)
= 0.3125 [(1)2 1] = 0
xi = 0.5
yi = 0.5
f (xi, yi) = f (0.5, 0.5) = 0.5 [(0.5)2 1]
= -0.375
xi = 1.5
yi = 0.3125
f (xi, yi) = f (1.5, 0.3125)
= 0.3125 [(1.5)2 1] = 0.390625
103
(Ecuacin predictora)h
yi yi 1 f xi , yi f xi 1 , yi 1
2
2
por lo que
yi 1 yi
f xi , yi f xi 1 , yi 1
h
2
(Ecuacin correctora)
Predictor
yi 1 1
2
f (xi, yi) = 1 [0 - 1] = -1
yi+1 = yi+ f (xi, yi) h = 1+ (-1) (0.5) = 0.5
1 0.4923
0 .5
2
- 1 - 47021
0.5 0.63245
2
Corrector
xi+1 = 0.5
yi 1 1
y i 1 y i
1
f x i , y i f x i 1 , y i 1
h
2
1 0.375
0.5 0.65625
2
0.62695
yi 1 1
- 1 - 0.4743
0.5 0.63142
2
yi 1 1
- 1 - 0.4736
0.5 0.63161
2
104
0.5
1.0
1.5
2.0
h = 0.25
y
1.0000
0.6316
0.5132
0.7464
3.9174
x
0.00
y
1.0000
0.25
0.7832
0.50
0.6322
0.75
0.5432
1.00
0.5135
1.25
0.5523
1.50
0.7006
1.75
1.0915
2.00
2.1965
x
0.000
0.125
0.250
0.375
0.500
0.625
0.750
0.875
1.000
1.125
1.250
1.375
1.500
1.625
1.750
1.875
2.000
h = 0.125
y
1.0000
0.8832
0.7830
0.6995
0.6323
0.5806
0.5436
0.5211
0.5134
0.5221
0.5501
0.6030
0.6905
0.8296
1.0499
1.4064
2.0031
mtodo de Heun
k1 = f (xi, yi);
Tercer Orden.
yi+1 = yi + [ 1 6 (k1 + 4k2 + k3)] h
donde
k1 = f (xi, yi);
Cuarto Orden.
105
k1 = f (xi, yi);
k3 = f (xi + 1 2 h, yi + 1 2 hk2);
k2 = f (xi+ 1 2 h, yi + 1 2 h k1);
k4 = f (xi + h, yi + h k3);
Ejemplo 6.3
Resuelva la ecuacin diferencial de los ejemplos anteriores por los mtodos de Runge-Kutta de segundo,
tercer y cuarto orden; s y(0) = 1, utilizando h = 0.5
dy
y x2 1
dx
Segundo Orden
yi+1 = yi + ( 1 3 k1 + 2 3 k2) h
y i = y(0) = 1
k1 = f (xi, yi) = f (0, 1) = 1(02-1) =-1
k2 = f (xi+ h, yi+ h k1)
xi+ h = 0+ (0.5) = 0.375
yi+ h k1 = 1 + (0.5)(-1) = 0.625
k2 = f (0.375, 0.625) = 0.625(0.3752 - 1)
= -0.5371
y i+1 = y (0.5)
= 1 + ( (-1) + (-0.5371)) (0.5)
= 0.6543
y i = y (0.5) = 0.6543
k1 = f (0.5, 0.6543) = -0.4907
xi+ h = 0.875
yi+ h k1 = 0.4703
k2 = f (0.875, 0.4703) = -0.1102
y i+1 = y (1) = 0.5358
y i = y (1) = 0.5358
k1 = f (1, 0.5358) = 0
xi+ h = 1.375
yi+ h k1 = 0.5358
k2 = f (1.375, 0.5358) = 0.4772
y i+1 = y (1.5) = 0.6948
y i = y (1.5) = 0.6948
k1 = f (1.5, 0.6948) = 0.8685
xi+ h = 1.875
yi+ h k1 = 1.0205
k2 = f (1.875, 1.0205) = 2.5673
y i+1 = y (2) = 1.6953
Tercer Orden
yi+1 = yi + [ (k1 + 4k2 + k3)] h
y i = y(0) = 1
k1 = f (xi, yi) = f (0, 1) = 1(02-1) = -1
k2 = f (xi+ h, yi+ h k1)
xi+ h = 0+ (0.5) = 0.25
yi+ h k1 = 1 + (0.5)(-1) = 0.75
k2 = f (0.25, 0.75) = 0.625(0.3752 - 1)
= -0.7031
k3 = f (xi+h, yi - hk1 +2hk2)
xi+h = 0 + 0.5 = 0.5
yi - hk1 +2hk2
= 10.5(-1)+2(0.5)(-0.7031)
= 0.7969
k3 = f (0.5, 0.7969) = -0.5977
y i+1 = y (0.5)
= 1 + (-1 + 4(-0.7031) + 0.7969) (0.5)
= 0.6325
y i = y (0.5) = 0.6325
106
y i = y (1) = 0.6995
k1 = f (1, 0.6995) = 0.8743
xi+ h = 1.75
yi+ h k1 = 0.9180
Cuarto Orden
y i = y(1) = 0.5133
k1 = f (1, 0.5133) = 0
xi+ h = 1.25
yi+ h k1 = 0.5133
k2 = f (0.75, 0.5138) = -0.2889
xi+ h = 1.25
yi+ h k2 = 0.5855
k3 = f (0.75, -0.5761) = 0.3294
xi+ h = 1.5
yi+ h k3 = 0.6780
k4 = f (1, 0.5063) = 0.8475
y i+1 = y (1.5) = 0.6870
y i = y(1.5) = 0.6870
k1 = f (1.5, 0.6870) = 0.8587
xi+ h = 1.75
yi+ h k1 = 0.9017
k2 = f (1.75, 0.9017) = 1.8597
xi+ h = 1.75
yi+ h k2 = 1.1519
k3 = f (1.75, 1.1519) = 2.3758
xi+ h = 2
yi+ h k3 = 1.8749
k4 = f (2, 1.8749) = 5.6248
y i+1 = y (2) = 1.933
y i = y(0.5) = 0.6323
k1 = f (0.5, 0.6323) = -0.4743
xi+ h = 0.75
yi+ h k1 = 0.5138
k2 = f (0.75, 0.5138) = -0.2248
xi+ h = 0.75
yi+ h k2 = 0.5761
k3 = f (0.75, -0.5761) = -0.2521
xi+ h = 1
yi+ h k3 = 0.5063
k4 = f (1, 0.5063) = 0
y i+1 = y (1) = 0.5133
dy
f x, y
dx
separando variables e integrando entre los lmites i e i+1
107
y i 1 y i
xi 1
xi
f x, y dx
y i 1 y i 3
4h
2 f ( xi , y i ) f ( xi 1 , y i 1 ) 2 f ( xi 2 , y i 2 )
3
Corrector
y i 1 y i 1
h
2 f ( xi 1 , y i 1 ) 4 f ( x i , y i ) 2 f ( x i 1 , y i 1 )
3
Un tipo de frmulas que tienen la forma general descrita anteriormente son las frmulas de Adams
Frmula abierta de n-simo orden
(Adams-Bashforth)
n 1
yi 1 yi h k f i k o h n 1
k 0
(Adams-Moulton)
n 1
y i 1 y i h k f i 1 k o h n 1
k 0
dy
y x2 1
dx
Predictor
59
37
9
55
fi
f i 1
f i 2
f i 3
24
24
24
24
y i 1 y i h
Corrector
19
5
1
9
f i 1
fi
f i 1
f i 2
24
24
24
24
y i 1 y i h
108
Primer Paso
xi = 0, yi = 1
xi - 1 = -0.5, yi - 1 = 1.581052
xi - 2 = -1, yi - 2 = 1.947028
xi - 3 = -1.5, yi - 3 = 1.453834
Segundo Paso
xi = 0.5, yi = 0.6379742
xi - 1 = 0, yi - 1 = 1
xi - 2 = -0.5, yi - 2 = 1.581052
xi - 3 = -1, yi - 3 = 1.947028
Predictor
y (0.5) = 0.9709569
Corrector
y (0.5) = 0.5911456
y (0.5) = 0.6445565
y (0.5) = 0.6370456
y (0.5) = 0.6381018
y (0.5) = 0.6379533
y (0.5) = 0.6379742
Predictor
y (1) = 0.735548
Corrector
y (1) = 0.5319068
dy1
f1 x, y1 , y2 ,... yn
dx
dy2
f 2 x, y1 , y2 ,... yn
dx
dyn
f n x, y1 , y2 ,... yn
dx
La solucin de este sistema requiere de n condiciones iniciales conocidas para un valor inicial de x.
Una ecuacin diferencial de orden superior puede escribirse como un sistema de ecuaciones diferenciales de
primer orden.
Escsriba la ecuacin diferencial ordinaria y(n) = f (x, y, y, y, ..., y(n - 1)) como un sistema de ecuaciones de
primer orden haciendo las sustituciones
y1 = y, y2 = y, ..., yn = y(n - 1)
Entonces:
y1 = y2
y2 = y3
yn = f (x, y1, y2, y3, ..., yn )
es un sistema de n ecuaciones diferenciales ordinarias.
Por ejemplo, considere el problema de valor inicial.
y -3y yy = 0
y (0) = 0
y (0) = 1
y (0) = -1
109
y2 = y y3 = y
entonces
y1 = y2
y2 = y3
y3 = 3y3 + y2 y1
con las condiciones iniciales
y1 (0) = 0
y2 (0) = 1
y3 (0) = -1
Ejemplo 6.5
Resolver el problema de valores en la frontera definido por la ecuacin:
d2y
y0
dx 2
si y(0) = 1, y(0) = 2; y calcular el valor de y(1).
Analticamente
Teorema.
Si la ecuacin auxiliar m2 + bm +c = 0 tiene las races complejas s ti, entonces la solucin general
de y + by + cy = 0 es y = esx (c1 cos tx + c2 sen tx)
En el ejemplo, para la ecuacin auxiliar b = 0 y c = 1
Por ello, s = 0 y t = 1, y la solucin general queda:
m2 + 1 = 0
m =i
c1 = 1
c2 = 2
y = cos x + 2sen x
y(1) = cos (1) + 2sen (1) = 2.223244
Utilizando el paquete Polymath, para x =1, y = 2.2232
110
Numricamente
Usando el mtodo de Runge-Kutta de segundo orden (mtodo de Ralston) con h = 0.5, y(0) = 1, y(0) = 2;
d2y
y0
dx 2
d dy1
y1 0
dx dx
dy1
y2
dx
dy 2
dy 2
y1 0
y1
dx
dx
Ecuaciones del mtodo:yj, i+1 = yj, i + ( k1, j + k2, j) h
k1, j = fj (xi, y1, i, y2, i,..., yn, i);
k2, j = fj (xi+ h, y1, i+ h k1, 1, y2, i+ h k1, 2,..., yn, i+ h k1, n,)
xi = 0; y1, i = 1; y2, i = 2
k1, 1 =f1 (0, 1, 2) = 2
k1, 2 =f2 (0, 1, 2) = -1
y1 (1) =
1.875 + [( (1.25) + (0.546875)](0.5)
= 2.265625
y2 (1) =
1.25 + [ (-1.875) + (-2.34375)](0.5)
= 0.15625
111
Ejemplo 6.6
Usando el mtodo de Runge-Kutta de cuarto orden con h = 0.5, y las mismas condiciones iniciales
Ecuaciones del mtodo:
yj, i+1 = yj, i + (k1, j + 2 k2, j+ 2 k3, j, + k4, j) h
k1, j = fj (xi, y1, i, y2, i,..., yn, i);
k2, j = fj (xi+ h, y1, i+ h k1, 1, y2, i+ h k1,2,... , yn, i+ h k1, n)
k3, j = fj (xi+ h, y1, i+ h k2, 1, y2, i+ h k2, 2j,... , yn, i+ h k2, n)
k4, j = fj (xi+ h, y1, i+ h k3, 1, y2, i+h k3, 2,... , yn, i+ h k3, n)
xi = 0; y1, i = 1; y2, i = 2
k1, 1 =f1 (0, 1, 2) = 2
k1, 2 =f2 (0, 1, 2) = -1
xi + h = 0 + (0.5) = 0.25
y1, i + h k1, 1 = 1 + (0.5)(2) = 1.5
y2, i + h k1, 2 = 2 + (0.5)(-1) = 1.75
k2, 1 = f1 (0.25, 1.5, 1.75) = 1.75
k2, 2 = f2 (0.25, 1.5, 1.75) = -1.5
xi + h = 0.25
y1, i + h k2, 1 = 1 + (0.5)(1.75) = 1.4375
y2, i + h k2, 2 = 2 + (0.5)(-1.5) = 1.625
k3, 1 = f1 (0.25, 1.4375, 1.625) = 1.625
k3, 2 = f2 (0.25, 1.4375, 1.625) = -1.4375
xi + h = 0.5
y1, i + h k3, 1 = 1 + (0.5)(1.625) = 1.8125
y2, i +h k3, 2 = 2 + (0.5)(-1.4375) = 1.28125
k4, 1 = f1 (0.5, 1.8125, 1.28125 = 1.28125
k4, 2 = f2 (0.5, 1.8125, 1.28125) = -1.8125
y1 (0.5)
=1+ [2+2(1.75)+2(1.625)+1.28125](0.5)
= 1.835938
y2 (0.5)
=2+ [-1+2(-1.5)+2(-1.4375)-1.8125](0.5)
= 1.276042
112
6.5 Aplicaciones
Aplicacin 6.1 Ley de Newton del enfriamiento
Una esfera de aluminio de 3 cm. de dimetro se calienta hasta una temperatura de 200 C. Entonces, en el
instante t = 0, se coloca en aire que se mantiene a una temperatura de 30 C. Si el coeficiente promedio de
transferencia de calor es de 20 W/m C, calcule el tiempo necesario para que la esfera alcance una
temperatura de 150 C.
Suponga las siguientes propiedades del aluminio:
k = 210 W / m C
c = 0.895 J / g C
= 2.72 g / cm3
Aplicando la primera ley de la termodinmica a la esfera, y suponiendo que el calor fluye tan rpidamente en
la esfera que la temperatura es prcticamente la misma en todos los puntos de la misma, el calor disipado por
la esfera se puede expresar analticamente por medio de la ecuacin diferencial homognea:
dT
hA
(T T ) 0
dt
cV
Donde
h = coeficiente de transferencia de calor
A = rea de la esfera para la transferencia de calor
= densidad de la esfera
V = volumen de la esfera
c = calor especifico de la esfera
h(4R 2 )
hA
3h
3 * 20
16.43x10 4 s 1
3
3
2
3
cV c( 4 R ) cR 2.75 x10 * 0.895 x10 * 1.5 x10
3
dT
16.43 x10 4 (T 30)
dt
t 0, T 200 C
113
PRINT "*
INSTITUTO TECNOLGICO DE DURANGO
*"
PRINT "* DEPARTAMENTO DE INGENIERA QUMICA Y BIOQUMICA*"
PRINT "*
MTODOS NUMERICOS
*"
PRINT "*
SOLUCIN DE ODE MTODO DE EULER
*"
PRINT "*
INSTRUCTOR: JOS DOMINGO POPE SOLIS
*"
PRINT "****************************************************************"
' ENTRADA DE DATOS
INPUT "tf "; tf
INPUT "H "; H
READ t, T
DATA 0, 200
N = (tf - t) / H
PRINT: PRINT "t
T"
PRINT t, T
FOR I = 1 TO N
T = T + H * F(t, T)
t=t+H
PRINT t, T
NEXT I
END
FUNCTION F(t, T)
F = (-16.43e-4)*(T - 30)
END FUNCTION
Ejecucin 6.1 Mtodo de Euler h = 5
*****************************************************************
*
INSTITUTO TECNOLGICO DE DURANGO
*
* DEPARTAMENTO DE INGENIERA QUMICA Y BIOQUMICA *
*
MTODOS NUMERICOS
*
*
SOLUCIN DE ODE MTODO DE EULER
*
*
INSTRUCTOR: JOS DOMINGO POPE SOLIS
*
*****************************************************************
VALOR FINAL DE TIEMPO 10
INTERVALO H
0.5
Tabla 6.3 Resultados de correr el programa 6.1 ordenados en forma tabular
t seg. T C t seg.
T C
t seg.
T C
t seg.
0
200.00 65
182.713308 130
167.184438 195
5
198.60 70
181.458768 135
166.057468 200
10
197.22 75
180.214534 140
164.939756 205
15
195.84 80
178.980522 145
163.831225 210
20
194.48 85
177.756647 150
162.731802 215
25
193.13 90
176.542826 155
161.64141
220
30
191.79 95
175.338977 160
160.559976 225
35
190.46 100
174.145017 165
159.487426 230
40
189.14 105
172.960866 170
158.423687 235
45
187.84 110
171.786442 175
157.368686 240
50
186.54 115
170.621667 180
156.322352 245
55
185.25 120
169.46646
185
155.284614 250
60
183.98 125
168.320743 190
154.255401
T C
153.234643
152.22227
151.218214
150.222407
149.23478
148.255266
147.283799
146.320313
145.364741
144.41702
143.477084
142.54487
114
La teora bsica de las interacciones depredador-presa fue propuesta en las dcadas de los veinte y treinta por
los pioneros Alfred Lotka y Vito Volterra. Lotka propuso sus ecuaciones haciendo una analoga con ciertas
reacciones qumicas, en tanto que Volterra se inspir en un problema sobre pesqueras en el mar Adritico.
Las ecuaciones, sin embargo, resultaron idnticas. El modelo de depredador-presa propuesto por Lotka y
Volterra no tiene ms que una importancia histrica. En la actualidad, los modelos generales de depredadorpresa son modificaciones o extensiones de las ecuaciones de Lotka-Volterra. En trminos generales, dichos
modelos son particularizaciones del siguiente:
Tasa de crecimiento de la
presa
Tasa de crecimiento de la
presa en ausencia del
depredador
dx
px qxy
dt
La ecuacin anterior corresponde a la dinmica de la poblacin de las presas, con una ecuacin
correspondiente para los depredadores.
Incremento en la tasa de
crecimiento del depredador
debido a la presencia de las
presas de la ecuacin
anterior
dy
sy rxy
dt
Los detalles biolgicos correspondientes a un sistema o clase de sistemas en particular se traducirn en una
forma especfica para las ecuaciones anteriores en funcin de los valores de p, q, r y s. Por ejemplo, la
ecuacin para las presas ser diferente si se trata de felino-gacela que cuando se trata de pjaro-oruga.
Para un sistema dado, el sistema de ecuaciones se puede expresar como:
dx
2 x 1.2 xy
dt
dy
y 0.9 xy
dt
en t 0, x 2
en t 0, y 1
Resolver el sistema para t = 10 con h = 0.5 usando el mtodo de Runge-Kutta cuarto orden
Programa 6.2 Mtodo de Runge-Kutta cuarto orden
PRINT "******************************************************************************"
PRINT "*
INSTITUTO TECNOLGICO DE DURANGO
*"
PRINT "*
DEPARTAMENTO DE INGENIERIAS QUMICA Y BIOQUMICA
*"
115
PRINT "*
MTODOS NUMRICOS
*"
PRINT "*
MODELO BSICO DEPREDAROR-PRESA
*"
PRINT "* SOLUCIN DEL SISTEMA POR EL MTODO DE RUNGE-KUTTA CUARTO ORDEN *"
PRINT "*
INSTRUCTOR: JOS DOMINGO POPE SOLIS
*"
PRINT "******************************************************************************"
INPUT "VALOR FINAL DE TIEMPO "; Tf
READ T, X, Y
DATA 0, 2, 1
INPUT "INTERVALO H
"; H
N = (Tf - T) / H
PRINT T, X, Y
FOR I = 1 TO N
K11 = F(T, X, Y)
K12 = G(T, X, Y)
K21 = F(T + .5 * H, X + .5 * H * K11, Y + .5 * H * K12)
K22 = G(T + .5 * H, X + .5 * H * K11, Y + .5 * H * K12)
K31 = F(T + .5 * H, X + .5 * H * K21, Y + .5 * H * K22)
K32 = G(T + .5 * H, X + .5 * H * K21, Y + .5 * H * K22)
K41 = F(T + H, X + H * K31, Y + H * K32)
K42 = G(T + H, X + H * K31, Y + H * K32)
X1 = X + H * (1 / 6) * (K11 + 2 * K21 + 2 * K31 + K41)
Y = Y + H * (1 / 6) * (K12 + 2 * K22 + 2 * K32 + K42)
T=T+H
X = X1
PRINT T, X, Y
NEXT I
END
FUNCTION F(T, X, Y)
F = 2*X - 1.2*X*Y
END FUNCTION
FUNCTION G(T, X, Y)
G = (-1)*Y + 0.9*X*Y
END FUNCTION
116
*
MTODOS NUMRICOS
*
*
MODELO BSICO DEPREDAROR-PRESA
*
* SOLUCIN DEL SISTEMA POR EL MTODO DE RUNGE-KUTTA CUARTO ORDEN
*
*
INSTRUCTOR: JOS DOMINGO POPE SOLIS
*
*******************************************************************************
VALOR FINAL DE TIEMPO
INTERVALO H
10
0.5
t (tiempo)
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
5.5
6
6.5
7
7.5
8
8.5
9
9.5
10
x (presa)
y (depredador)
2
1
2.48753405
1.7209284
1.71540573
2.78769076
0.79674181
2.91807071
0.44787062
2.30396979
0.37178288
1.669793
0.42991085
1.20772636
0.62162002
0.92274406
1.01547679
0.80177991
1.68624889
0.88508871
2.4019644
1.36576392
2.13221144
2.41497402
1.07269346
3.00432733
0.53680762
2.56092812
0.38428791
1.89411688
0.39639645
1.36319352
0.53242309
1.01397804
0.83859212
0.83091722
1.4011262
0.82589839
2.17139134
1.11973653
2.40097536
1.98437432
117