# Cartesian to Spherical coordinates Calculator

## Converts from Cartesian (x,y,z) to Spherical (r,θ,φ) coordinates in 3-dimensions. | ||

- Purpose of use
- Computer graphics software usage

[1] 2020/05/31 19:57 Male / 20 years old level / High-school/ University/ Grad student / Very /

- Purpose of use
- Making a key for a calc iii final exam

[2] 2019/12/09 23:14 Male / 60 years old level or over / A teacher / A researcher / Very /

- Purpose of use
- checking answers

[3] 2019/12/04 07:25 Male / 40 years old level / A teacher / A researcher / Useful /

- Purpose of use
- Homework
- Comment/Request
- Exact answer in radian conversion is more helpful

[4] 2019/11/09 14:22 Male / Under 20 years old / High-school/ University/ Grad student / Useful /

- Purpose of use
- Homework

[5] 2019/07/16 08:57 Male / Under 20 years old / High-school/ University/ Grad student / Useful /

- Purpose of use
- Writing computer graphics software.

[6] 2018/12/13 23:42 Male / 20 years old level / Self-employed people / Very /

- Purpose of use
- Check work

[7] 2018/08/29 00:07 Male / 20 years old level / High-school/ University/ Grad student / Very /

- Purpose of use
- homework
- Comment/Request
- explanation

[8] 2018/05/07 19:40 Male / 20 years old level / High-school/ University/ Grad student / Very /

- Purpose of use
- for mapping

[9] 2018/03/13 12:30 Male / 40 years old level / An office worker / A public employee / Very /

- Purpose of use
- Seventeenth source to verify equations derived from first-principles.
- Comment/Request
- Comment 14 had a point on the calculation of phi, though he was incorrect in claiming that your equation is "wrong". Your equation is correct but degenerate in that it suffers from gimbal-lock. Your solution for theta has a similar issue. For a solution free of both of these issues, use:

theta = atan2(y, x) % <- ***

% *** - Check implementation in whatever language you are using, most are

% denominator then numerator. Some are not.

phi = acos(z/r)

With this formulation the only degenerate case is a zero length radius, for which the angles are undefined. As such the input is degenerate and the output being degenerate follows.

[10] 2018/03/09 01:56 Male / 50 years old level / An engineer / Useful /

**To improve this 'Cartesian to Spherical coordinates Calculator', please fill in questionnaire.**

**The hyperlink to [Cartesian to Spherical coordinates]**