How do we deal with ArcTan (or other inverse functions) of undefined values?

$\begingroup$

When converting coordinates from rectangular to cylindrical, to spherical, etc. we will eventually come across having to use $ArcTan(y/x)$, and/or $ArcCos(z/\rho)$ to derive $\theta$ and/or $\phi$. However, sometimes the $x$ coordinate used in $ArcTan(y/x)$ may very well be $0$, which makes the fraction undefined. How do we retrieve the angle we need in this situation?

$\endgroup$ 0

2 Answers

$\begingroup$

if $x = \rho\cos\theta\sin\phi\\y = \rho\sin\theta\sin\phi\\z = \rho\cos\phi$

then $\frac {y}{x} = \tan \theta$ and $\arctan \frac{y}{x} = \arctan (\tan\theta) = \theta$ if $\theta \in (-\frac{\pi}{2},\frac {\pi}{2})$

If $\theta$ is not in the correct interval you will need to add (or subtract) some multiple of $\pi$

If $x=0$ then $\arctan \frac{y}{x}$ is undefined, but you may be able to find a limit as x approaches 0.

$\endgroup$ $\begingroup$

When converting from rectangular to cylindrical, the statement that $\theta=\arctan \frac yx$ is a bit sloppy. You need to start with if $x=0, \theta = \pm \frac \pi 2$ depending on the sign of $y$ because the arctangent never returns $\pm \frac \pi 2$. Then you can use the arctangent formula, but you may have to add $\pi$ depending on the quadrant. Computer languages have an atan2 function that takes care of all that for you. The conversion to spherical is similar.

$\endgroup$ 3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like