# Ejercicio 12.13

kill(all)$

Designamos por T el tiempo que tarda la bala en atravesar la madera
x(t) , distancia recorrida por la bala
v(t) = Dx(t), velocidad de la bala. v(0) = 200m/s, v(T) = 80m/s

EDO:  'diff(x,t,2) +a*('diff(x,t))^2 = 0;

ode2(EDO, x, t);

define (x(t) , log(a*t+ k1*a)/a+ k2);

define (Dx(t) , diff(x(t) ,t));

Eq1 : x(0) = 0;
Eq2:  Dx(0) = 200;
solve ([Eq1, Eq2] , [k1,k2]);

k1 : 1/(200*a);
k2 : (2*log(5)+3*log(2))/a;

Eq3: Dx(T)=80;

Eq4: x(T) = 0.1;

Eq5 : log(1/80)/a+(2*log(5)+3*log(2))/a=0.1;

solve (Eq5 , a), numer;

a = a: 9.1629;

Eq6 : 1/(9.1629*T+1/200)=80;
solve (Eq6, T);

%, numer;

wxplot2d([Dx(t)], [t,0,0.00085],  [ylabel, ""] , [legend, "Dx(t)"] , [style, [lines, 2]] ,
 [gnuplot_preamble, "set grid; set zeroaxis;"])$