Skip to content

Instantly share code, notes, and snippets.

@revirth
Created January 24, 2016 14:40
Show Gist options
  • Save revirth/3fecae3819c22eb8f337 to your computer and use it in GitHub Desktop.
Save revirth/3fecae3819c22eb8f337 to your computer and use it in GitHub Desktop.
When I study Vectors on KahnAcademy site, need to make a function to calculate to find a component from 2 vectors
# https://www.khanacademy.org/math/linear-algebra/vectors_and_spaces/vectors/e/adding-vectors-in-magnitude-and-direction-form
def findComponent(v,vR,w,wR):
l = v*math.cos(math.radians(vR))+w*math.cos(math.radians(wR))
r = v*math.sin(math.radians(vR))+w*math.sin(math.radians(wR))
return (l,r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment