Cartesian to Spherical

• Apr 28th 2010, 04:48 PM
centenial
Cartesian to Spherical
Hi,

I need to convert these coordinates from cartesian to spherical.

(3,4,12)

and these coordinates from spherical to cartesian

(5, $\frac{\pi}{4}$, $\frac{\pi}{6}$)

I've done a bunch of searches, but none of the websites I found were very clear. Could someone explain this to me?
• Apr 28th 2010, 06:32 PM
Prove It
You should know that

$x = r\sin{\theta}\cos{\phi}$

$y = r\sin{\theta}\sin{\phi}$

$z = r\cos{\theta}$.

Going the other way:

$r = \sqrt{x^2 + y^2 + z^2}$

$\theta = \arccos{\frac{z}{x^2 + y^2 + z^2}}$

Finding $\phi$ is more difficult as it depends on the values of $x$ and $y$.

Namely:

$\phi = \arctan{\frac{y}{x}}$ for $x > 0$

$\phi = \pi + \arctan{\frac{y}{x}}$ for $y \geq 0, x < 0$

$\phi = -\pi + \arctan{\frac{y}{x}}$ for $y < 0, x < 0$

$\phi = \frac{\pi}{2}$ for $y > 0, x = 0$

$\phi = -\frac{\pi}{2}$ for $y < 0, x = 0$

$\phi =$ undefined for $y = 0, x = 0$.

These values come from elementary trigonometry.