Hacker News new | past | comments | ask | show | jobs | submit login

It's Python 3. You ran it with Python 2. In Python 2, 1/2 == 0. In Python 3, 1/2 == 0.5. That means that in the drag function, this expression:

  1/2 * p * Cd * math.pi * r**2 * v**2
always gives 0 on Python 2 because of that 1/2 factor.

If you want to run it on Python 2, either change the 1/2 in the drag function to 1./2 or 0.5, or add

  from __future__ import division
at the top to tell Python 2 you want to use the Python 3 division behavior.



Then I stand corrected. Thank you for being patient.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: