There is more information in the docstring for the
The radius is \(r\), the inclination angle is \(\theta\) and the azimuth angle is \(\phi\). Spherical coordinates are specified by the tuple of \((r, \theta, \phi)\) in that order.
Here is a good illustration we made from the scripts kindly provided by Jorge Stolfi on wikipedia.
The formulae relating Cartesian coordinates \((x, y, z)\) to \(r, \theta, \phi\) are:
and from \((r, \theta, \phi)\) to \((x, y, z)\):
See wikipedia spherical coordinate system . The mathematics convention reverses the meaning of \(\theta\) and \(\phi\) so that \(\theta\) refers to the azimuthal angle and \(\phi\) refers to the inclination angle.
Matlab has functions
cart2sph. These use the terms
phi, but with a different meaning again from the standard
physics and mathematics conventions. Here
theta is the azimuth angle, as
for the mathematics convention, but
phi is the angle between the reference
plane and OP. This implies different formulae for the conversions between
Cartesian and spherical coordinates that are easy to derive.