Skip to content

Instantly share code, notes, and snippets.

@ericabell
Created November 15, 2014 13:02
Show Gist options
  • Save ericabell/e6c1647225121120be45 to your computer and use it in GitHub Desktop.
Save ericabell/e6c1647225121120be45 to your computer and use it in GitHub Desktop.
easy way to get a unit vector
def unit(v):
mag = sqrt(v[0]*v[0]+v[1]*v[1])
return (v[0]/mag, v[1]/mag)
VF = plot_vector_field(unit([-y,-x]),[x,-2,2],[y,-2,2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment