Created
January 2, 2017 22:13
-
-
Save fogleman/c360a88d68105a89656a723c7e1b2be8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
def meet(x, vi, vf, a): | |
x1 = (2 * a * x + vi * vi - vf * vf) / (4 * a) | |
x2 = x - x1 | |
v = (vi * vi + 2 * a * x1) ** 0.5 | |
t1 = (v - vi) / a | |
t2 = (vf - v) / -a | |
cx1 = vi * t1 + 0.5 * a * t1 * t1 | |
cx2 = v * t2 + 0.5 * -a * t2 * t2 | |
return x1, x2, v, t1, t2, cx2 | |
def main(): | |
print meet(10, 3, 0, 1) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment