Skip to content

Instantly share code, notes, and snippets.

@fogleman
Created January 2, 2017 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fogleman/c360a88d68105a89656a723c7e1b2be8 to your computer and use it in GitHub Desktop.
Save fogleman/c360a88d68105a89656a723c7e1b2be8 to your computer and use it in GitHub Desktop.
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