Created
November 19, 2018 15:32
-
-
Save telliott99/916bc75a73e515968debe48ef418d738 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 math import * | |
# requires x != 0 | |
def radial(x,y): | |
r = (x**2 + y**2)**0.5 | |
t = atan(1.0*y/x) | |
return r,t | |
def cartesian(r,t): | |
x = cos(t) * r | |
y = sin(t) * r | |
return x,y | |
def power(x,y,n): | |
r,t = radial(x,y) | |
r = r**n | |
t = t*n | |
x,y = cartesian(r,t) | |
return round(x,2), round(y,2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment