fork download
  1. import math as mt
  2. angle = mt.radians(48)
  3. print(angle)
  4. V = 4.733
  5. g = -9.80665
  6. Vx = mt.cos(angle)*V
  7. Vy = mt.sin(angle)*V
  8. position = [0, 1.13]
  9. timestep = 0.00001
  10. t = 0
  11. Vxt = Vx/timestep
  12. Vyt = Vy/timestep
  13. gt = g/timestep
  14. while(position[1]>0):
  15. Vy = Vy + gt
  16. Vx = Vx - ((0.5*(Vx**2)*0.0006477025*timestep)/(2*0.0095))
  17. Vy = Vy - ((0.5*(Vy**2)*0.0006477025*timestep)/(2*0.0095))
  18. Vxt = Vx/timestep
  19. Vyt = Vy/timestep
  20. t = t + timestep
  21. position[0] = position[0] + Vx
  22. position[1] = position[1] + Vy
  23. print(position[0])
  24. print(t)
Success #stdin #stdout 0.13s 14272KB
stdin
Standard input is empty
stdout
0.8377580409572782
3.166993450326917
1e-05