Ejercicio : 2Eva_2021PAOII_T2 EDO – Embudos cónicos para llenar botellas
literal a
La expresión dada en el enunciado para EDO, se reordena para definir la funcion a usar con Runge-Kutta:
δ y ( t ) δ t + d 2 4 2 g y ( t ) [ t a n θ y ( t ) ] 2 = 0 \frac{\delta y(t)}{\delta t} + \frac{d^2}{4}\sqrt{2 g \text{ }y(t)}\Bigg[\frac{tan \theta}{y(t)} \Bigg]^2 = 0 δ t δ y ( t ) + 4 d 2 2 g y ( t ) [ y ( t ) t a n θ ] 2 = 0
δ y ( t ) δ t = − d 2 4 2 g y ( t ) [ t a n θ y ( t ) ] 2 \frac{\delta y(t)}{\delta t} = - \frac{d^2}{4}\sqrt{2 g \text{ }y(t)}\Bigg[\frac{tan \theta}{y(t)} \Bigg]^2 δ t δ y ( t ) = − 4 d 2 2 g y ( t ) [ y ( t ) t a n θ ] 2
siendo h = 0.5, con y(0) = 0.15 m y d= 0.01 m ajustando las unidades de medida.
δ y ( t ) δ t = − 0 . 0 1 2 4 2 ( 9 . 8 ) y ( t ) [ t a n ( π / 4 ) y ( t ) ] 2 \frac{\delta y(t)}{\delta t} = - \frac{0.01^2}{4}\sqrt{2 (9.8) \text{ }y(t)}\Bigg[\frac{tan (\pi/4)}{y(t)} \Bigg]^2 δ t δ y ( t ) = − 4 0 . 0 1 2 2 ( 9 . 8 ) y ( t ) [ y ( t ) t a n ( π / 4 ) ] 2
δ y ( t ) δ t = − ( 1 . 1 0 6 8 e − 4 ) y ( t ) [ 1 y ( t ) ] 2 \frac{\delta y(t)}{\delta t} = - (1.1068e-4) \sqrt{ y(t)}\Bigg[\frac{1}{y(t)} \Bigg]^2 δ t δ y ( t ) = − ( 1 . 1 0 6 8 e − 4 ) y ( t ) [ y ( t ) 1 ] 2
δ y ( t ) δ t = − ( 1 . 1 0 6 8 e − 4 ) y ( t ) y ( t ) 2 \frac{\delta y(t)}{\delta t}= - (1.1068e-4) \frac{\sqrt{ y(t)}}{y(t)^2} δ t δ y ( t ) = − ( 1 . 1 0 6 8 e − 4 ) y ( t ) 2 y ( t )
literal b
se inicia el cálculo del siguiente punto de la tabla
i
t
y
0
0
0.15
1
0.5
0.1490
2
1
0.1480
3
1.5
0.1471
i = 0
K 1 = h ( − ( 1 . 1 0 6 8 e − 4 ) y ( t ) y ( t ) 2 ) K_1 = h\Bigg(- (1.1068e-4) \frac{\sqrt{ y(t)}}{y(t)^2} \Bigg) K 1 = h ( − ( 1 . 1 0 6 8 e − 4 ) y ( t ) 2 y ( t ) )
K 1 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) 0 . 1 5 0 . 1 5 2 ) = − 9 . 5 2 5 8 e − 0 4 K_1 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{0.15}}{0.15^2}\Bigg) = -9.5258e-04 K 1 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) 0 . 1 5 2 0 . 1 5 ) = − 9 . 5 2 5 8 e − 0 4
K 2 = h ( − ( 1 . 1 0 6 8 e − 4 ) y ( t ) + K 1 ( y ( t ) + K 1 ) 2 ) K_2 = h\Bigg(- (1.1068e-4) \frac{\sqrt{ y(t)+K_1}}{(y(t)+K_1)^2} \Bigg) K 2 = h ( − ( 1 . 1 0 6 8 e − 4 ) ( y ( t ) + K 1 ) 2 y ( t ) + K 1 )
K 2 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) 0 . 1 5 + − 9 . 5 2 5 8 e − 0 4 ( 0 . 1 5 − 9 . 5 2 5 8 e − 0 4 ) 2 ) K_2 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{ 0.15+-9.5258e-04}}{(0.15-9.5258e-04)^2} \Bigg) K 2 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) ( 0 . 1 5 − 9 . 5 2 5 8 e − 0 4 ) 2 0 . 1 5 + − 9 . 5 2 5 8 e − 0 4 )
K 2 = − 9 . 6 1 7 3 e − 0 4 K_2 = -9.6173e-04 K 2 = − 9 . 6 1 7 3 e − 0 4
y 1 = y 0 + K 1 + K 2 2 y_1 = y_0 + \frac{K_1 + K_2}{2} y 1 = y 0 + 2 K 1 + K 2
y 1 = 0 . 1 5 + − 9 . 5 2 5 8 e − 0 4 − 9 . 6 1 7 3 e − 0 4 2 = 0 . 1 4 9 y_1 = 0.15 + \frac{-9.5258e-04 -9.6173e-04}{2} = 0.149 y 1 = 0 . 1 5 + 2 − 9 . 5 2 5 8 e − 0 4 − 9 . 6 1 7 3 e − 0 4 = 0 . 1 4 9
i = 1
K 1 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) 0 . 1 4 9 0 . 1 4 9 2 ) = − 9 . 6 1 7 7 e − 0 4 K_1 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{0.149}}{0.149^2}\Bigg) =-9.6177e-04 K 1 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) 0 . 1 4 9 2 0 . 1 4 9 ) = − 9 . 6 1 7 7 e − 0 4
K 2 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) 0 . 1 4 9 − 9 . 7 1 2 0 e − 0 4 ( 0 . 1 4 9 − 9 . 7 1 2 0 e − 0 4 ) 2 ) K_2 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{ 0.149-9.7120e-04}}{(0.149-9.7120e-04)^2} \Bigg) K 2 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) ( 0 . 1 4 9 − 9 . 7 1 2 0 e − 0 4 ) 2 0 . 1 4 9 − 9 . 7 1 2 0 e − 0 4 )
K 2 = − 9 . 7 1 1 6 e − 0 4 K_2 = -9.7116e-04 K 2 = − 9 . 7 1 1 6 e − 0 4
y 2 = y 1 + − 9 . 6 1 7 7 e − 0 4 + − 9 . 7 1 1 6 e − 0 4 2 = 0 . 1 4 8 0 y_2 = y_1 + \frac{-9.6177e-04 + -9.7116e-04}{2} = 0.1480 y 2 = y 1 + 2 − 9 . 6 1 7 7 e − 0 4 + − 9 . 7 1 1 6 e − 0 4 = 0 . 1 4 8 0
i = 2
K 1 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) 0 . 1 4 8 0 0 . 1 4 8 0 2 ) = − 9 . 7 1 2 0 e − 0 4 K_1 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{0.1480}}{0.1480^2}\Bigg) = -9.7120e-04 K 1 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) 0 . 1 4 8 0 2 0 . 1 4 8 0 ) = − 9 . 7 1 2 0 e − 0 4
K 2 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) 0 . 1 4 8 0 − 9 . 7 1 2 0 e − 0 4 ( 0 . 1 4 8 0 − 9 . 7 1 2 0 e − 0 4 ) 2 ) K_2 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{ 0.1480-9.7120e-04}}{(0.1480-9.7120e-04)^2} \Bigg) K 2 = 0 . 5 ( − ( 1 . 1 0 6 8 e − 4 ) ( 0 . 1 4 8 0 − 9 . 7 1 2 0 e − 0 4 ) 2 0 . 1 4 8 0 − 9 . 7 1 2 0 e − 0 4 )
K 2 = − 9 . 8 0 8 4 e − 0 4 K_2= -9.8084e-04 K 2 = − 9 . 8 0 8 4 e − 0 4
y 3 = y 2 + − 9 . 7 1 2 0 e − 0 4 + − 9 . 8 0 8 4 e − 0 4 2 = 0 . 1 4 7 1 y_3 = y_2 + \frac{-9.7120e-04 + -9.8084e-04}{2} = 0.1471 y 3 = y 2 + 2 − 9 . 7 1 2 0 e − 0 4 + − 9 . 8 0 8 4 e − 0 4 = 0 . 1 4 7 1
literal c
Resultados usando Algoritmo, se encuentra que el embudo se vacia entre 3.15 y 3.20 segundos
[ t , y , K1 , K2 ]
[[ 0.0000e+00 1.5000e-01 0.0000e+00 0.0000e+00]
[ 5.0000e-01 1.4904e-01 -9.5258e-04 -9.6173e-04]
[ 1.0000e+00 1.4808e-01 -9.6177e-04 -9.7116e-04]
[ 1.5000e+00 1.4710e-01 -9.7120e-04 -9.8084e-04]
[ 2.0000e+00 1.4611e-01 -9.8088e-04 -9.9078e-04]
[ 2.5000e+00 1.4512e-01 -9.9083e-04 -1.0010e-03]
...
[ 3.1000e+01 2.8617e-02 -7.5631e-03 -1.0583e-02]
[ 3.1500e+01 1.0620e-02 -1.1431e-02 -2.4563e-02]
[ 3.2000e+01 nan -5.0566e-02 nan]
[ 3.2500e+01 nan nan nan]
Instrucciones Python
# 2Eva_2021PAOII_T2 EDO – Embudos cónicos para llenar botellas
import numpy as np
def rungekutta2 (d1y,x0,y0,h,muestras):
tamano = muestras + 1
estimado = np.zeros(shape=(tamano,4),dtype=float )
# incluye el punto [x0,y0,K1,K2]
estimado[0] = [x0,y0,0,0]
xi = x0
yi = y0
for i in range (1,tamano,1):
K1 = h * d1y(xi,yi)
K2 = h * d1y(xi+h, yi + K1)
yi = yi + (K1+K2)/2
xi = xi + h
estimado[i] = [xi,yi,K1,K2]
return (estimado)
# INGRESO
d = 0.01
theta = np.pi/4
g = 9.8
d1y = lambda t,y: -(d**2)/4*np.sqrt(2*g*y)*(np.tan(theta)/y)**2
t0 = 0
y0 = 0.15
h = 0.5
muestras = 70
# PROCEDIMIENTO
tabla = rungekutta2(d1y,t0,y0,h,muestras)
# SALIDA
np.set_printoptions(precision=4)
print ('[ t , y , K1 , K2 ]' )
print (tabla)