Created
November 15, 2014 13:02
-
-
Save ericabell/e6c1647225121120be45 to your computer and use it in GitHub Desktop.
easy way to get a unit vector
This file contains hidden or 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
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