s2Eva_2021PAOII_T2 EDO – Embudos cónicos para llenar botellas

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+d242g y(t)[tanθ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 δy(t)δt=d242g y(t)[tanθ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

siendo h = 0.5,  con y(0) = 0.15 m y d= 0.01 m ajustando las unidades de medida.

δy(t)δt=0.01242(9.8) y(t)[tan(π/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 δy(t)δt=(1.1068e4)y(t)[1y(t)]2 \frac{\delta y(t)}{\delta t} = - (1.1068e-4) \sqrt{ y(t)}\Bigg[\frac{1}{y(t)} \Bigg]^2 δy(t)δt=(1.1068e4)y(t)y(t)2 \frac{\delta y(t)}{\delta t}= - (1.1068e-4) \frac{\sqrt{ y(t)}}{y(t)^2}

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

K1=h((1.1068e4)y(t)y(t)2) K_1 = h\Bigg(- (1.1068e-4) \frac{\sqrt{ y(t)}}{y(t)^2} \Bigg) K1=0.5((1.1068e4)0.150.152)=9.5258e04 K_1 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{0.15}}{0.15^2}\Bigg) = -9.5258e-04 K2=h((1.1068e4)y(t)+K1(y(t)+K1)2) K_2 = h\Bigg(- (1.1068e-4) \frac{\sqrt{ y(t)+K_1}}{(y(t)+K_1)^2} \Bigg) K2=0.5((1.1068e4)0.15+9.5258e04(0.159.5258e04)2) K_2 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{ 0.15+-9.5258e-04}}{(0.15-9.5258e-04)^2} \Bigg) K2=9.6173e04 K_2 = -9.6173e-04 y1=y0+K1+K22 y_1 = y_0 + \frac{K_1 + K_2}{2} y1=0.15+9.5258e049.6173e042=0.149 y_1 = 0.15 + \frac{-9.5258e-04 -9.6173e-04}{2} = 0.149

i = 1

K1=0.5((1.1068e4)0.1490.1492)=9.6177e04 K_1 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{0.149}}{0.149^2}\Bigg) =-9.6177e-04 K2=0.5((1.1068e4)0.1499.7120e04(0.1499.7120e04)2) K_2 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{ 0.149-9.7120e-04}}{(0.149-9.7120e-04)^2} \Bigg) K2=9.7116e04 K_2 = -9.7116e-04 y2=y1+9.6177e04+9.7116e042=0.1480 y_2 = y_1 + \frac{-9.6177e-04 + -9.7116e-04}{2} = 0.1480

i = 2

K1=0.5((1.1068e4)0.14800.14802)=9.7120e04 K_1 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{0.1480}}{0.1480^2}\Bigg) = -9.7120e-04 K2=0.5((1.1068e4)0.14809.7120e04(0.14809.7120e04)2) K_2 = 0.5\Bigg(- (1.1068e-4) \frac{\sqrt{ 0.1480-9.7120e-04}}{(0.1480-9.7120e-04)^2} \Bigg) K2=9.8084e04 K_2= -9.8084e-04 y3=y2+9.7120e04+9.8084e042=0.1471 y_3 = y_2 + \frac{-9.7120e-04 + -9.8084e-04}{2} = 0.1471

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)