1 from numpy.lib.scimath 
import sqrt
 
    2 from numpy.lib.type_check 
import isreal
 
    3 from numpy.lib.ufunclike 
import isposinf
 
    4 import numpy.polynomial 
as poly
 
    6 import matplotlib.pyplot 
as plt
 
   13 Tr_poly_coeffs = (-dtot -Ttot*Vrob, (2/3)*amax*Ttot, -4/3 + (8/9 - 4/15)*amax)
 
   15 Tr_list = poly.Polynomial(Tr_poly_coeffs).roots()
 
   18 print(poly.Polynomial(Tr_poly_coeffs).coef)
 
   21 print(Tr_list[isreal(Tr_list)*(Tr_list>=0)])
 
   22 Tr = Tr_list[isreal(Tr_list)*(Tr_list>=0)][0]
 
   26 a = -(2/3)*amax/(Tr**3)
 
   30 coeffs = (c, 0, b, 0, a)
 
   32 t1 = np.linspace(0, Tr, 50)
 
   33 t2 = np.linspace(Tr, Tr + Th, 100)
 
   34 t3 = np.linspace(Tr + Th, Ttot, 50)
 
   35 f = poly.Polynomial(coeffs)
 
   38 x2 = np.array([
f(Tr)]*t2.shape[0])
 
   41 t = np.concatenate((t1, t2, t3))
 
   42 x = np.concatenate((x1, x2, x3))