Advertisement
Geometrian

Velocity/Displacement Equations for Rockets

Sep 15th, 2019
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. from math import *
  2.  
  3.  
  4. t_f = 1913.87
  5. I_sp = 178444.0
  6. m_dot = -651.71
  7. m_0 = 2166828.0
  8.  
  9. g_0 = -9.80665
  10. c = 299792458.0
  11.  
  12.  
  13. def v(t,v_0=0.0):
  14.     return -g_0*I_sp*log(1.0+m_dot/m_0*t) + v_0
  15.  
  16. def x(t,v_0=0.0):
  17.     a = 1.0 + (m_dot/m_0)*t
  18.     def fn(u):
  19.         return u*log(u) - u
  20.     return (m_0/m_dot) * ( -g_0*I_sp*(fn(a)-fn(1.0)) + v_0*(a-1.0) )
  21.  
  22.  
  23. print("Velocity:")
  24. print("    v(0  ) = %f"%v(0.0))
  25. print("    v(t_f) = %f"%v(t_f))
  26. print()
  27. print("Displacement:")
  28. print("    x(0             ) = %f, %f"%( x(0.0           ), x(0.0           )/c ))
  29. print("    x(t_f           ) = %f, %f"%( x(t_f           ), x(t_f           )/c ))
  30. print("    x(0,  -1500000.0) = %f, %f"%( x(0.0,-1500000.0), x(0.0,-1500000.0)/c ))
  31. print("    x(t_f,-1500000.0) = %f, %f"%( x(t_f,-1500000.0), x(t_f,-1500000.0)/c ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement