Coordinates of an n-sphere

95 Views Asked by At

I'm a little embarrassed to ask this question because it should be easy but it's stumped me for over a week now. The answer will determine how I write some code, so it matters.

According to Wikipedia the coordinates of an n-sphere in $n$ coordinates is given as

\begin{align} x_1 &= r \cos(\phi_1) \\ x_2 &= r \sin(\phi_1) \cos(\phi_2) \\ x_3 &= r \sin(\phi_1) \sin(\phi_2) \cos(\phi_3) \\ &\vdots\\ x_{n-1} &= r \sin(\phi_1) \cdots \sin(\phi_{n-2}) \cos(\phi_{n-1}) \\ x_n &= r \sin(\phi_1) \cdots \sin(\phi_{n-2}) \sin(\phi_{n-1}) \,. \end{align}

By this formula, the coordinates of an n-sphere in 4 coordinates should be

\begin{align} x_1 &= r \cos(\phi_1) \\ x_2 &= r \sin(\phi_1) \cos(\phi_2) \\ x_3 &= r \sin(\phi_1) \sin(\phi_2) \cos(\phi_3) \\ x_4 &= r \sin(\phi_1) \sin(\phi_2) \sin(\phi_3) \end{align}

Whereas mathworld.wolfram.com gives coordinates as (allowing for a change of notation and ordering)

\begin{align} x_1 &= r \cos(\phi_1) \\ x_2 &= r \sin(\phi_1) \cos(\phi_2) \\ x_3 &= r \sin(\phi_1) \sin(\phi_2) \sin(\phi_3) \\ x_4 &= r \sin(\phi_1) \sin(\phi_2) \cos(\phi_3) \end{align}

Which is correct? Note that $x_3$ and $x_4$ are swapped in my version and wolfram's.