In Python, if one wanted to create the effect of atan2() from the atan() function, how would one go about this? For example, if I had cartesian coordinates (x, y) and wanted to find the arctan of (x, y) using the atan() function such that it worked in all quadrants, so regardless of the sign of x or y, how could I do this without using the atan2() function? In the example of converting between cartesian and polar:
def cartopol(x, y):
r = (x**2 + y**2)**0.5
p = math.atan(y/x)
return(r,p)
This formula for returning the correct angle in radians would not currently work using the atan() function, so what must change?