#The jet propagation in a medium. Modeled by Ehud Nakar, implemented by Ore Gottlieb.
#The function HeadLoc receives the medium density profile in rho (g/cm^3) on the z axis (z), and the jet luminosity in Lj(erg/s) and opening angle in theta0(rad).
#The function HeadLoc returns three vectors. The jet head location (zh) and velocity/c (bh) at time (t).
import numpy as np
import math
from scipy import interpolate
from scipy.optimize import root
def find_Lt( Lt,z,rho,Lj,theta0):
Luncal=(Lj/theta0**4/rho/z**2/3e10**3*16/math.pi)**0.4*(1/(1+1/np.sqrt(Lt)))**0.8
Lcol=theta0**(-4/3)*16**(2/3)
if Luncal<1:
Ns=0.35
elif Luncal