The ATAN function returns the angle, expressed in radians, whose tangent is X (i.e., the arc-tangent). If two parameters are supplied, the angle whose tangent is equal to Y/X is returned. The range of ATAN is between - p /2 and p /2 for the single argument case, and between - p and p if two arguments are given.
To find the arc-tangent of 0.707 and store the result in the variable B, enter:
The following code defines a function that converts Cartesian coordinates to polar coordinates. It returns "r" and "theta" given an "x" and "y" position:
FUNCTION TO_POLAR, X, Y ; Define function TO_POLAR that accepts X and Y as arguments.
RETURN, [SQRT(X^2 + Y^2), ATAN(Y, X)]
;
Return the distance and angle as a two-element array.