       Converting between Spherical and Cartesian coordinates

• To: mathgroup at smc.vnet.net
• Subject: [mg53296] Converting between Spherical and Cartesian coordinates
• From: Alain Cochard <alain at geophysik.uni-muenchen.de>
• Date: Wed, 5 Jan 2005 01:21:09 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```I use spherical coordinates:

In:= << Calculus`VectorAnalysis` ;

In:= SetCoordinates[Spherical]

Out= Spherical[Rr, Ttheta, Pphi]

and I convert:

In:= CoordinatesFromCartesian[{x,y,z}]

2    2    2                  z
Out= {Sqrt[x  + y  + z ], ArcCos[------------------], ArcTan[x, y]}
2    2    2
Sqrt[x  + y  + z ]

Now, if I use the expressions for x, y, and z, I expect to get back to
Rr, Ttheta, Pphi, but:

In:= FullSimplify[%3/.{
x->Rr Sin[Ttheta]Cos[Pphi],
y->Rr Sin[Ttheta]Sin[Pphi],
z->Rr Cos[Ttheta]},
Rr>=0 && 0 <= Ttheta <= Pi && -Pi < Pphi <= Pi]

Out= {Rr, Ttheta, ArcTan[Rr Cos[Pphi] Sin[Ttheta],

>     Rr Sin[Pphi] Sin[Ttheta]]}

Even if I remove the equalities from the assumptions, I am not quite
there:

In:= FullSimplify[%3/.{
x->Rr Sin[Ttheta]Cos[Pphi],
y->Rr Sin[Ttheta]Sin[Pphi],
z->Rr Cos[Ttheta]},
Rr>0 && 0 < Ttheta < Pi && -Pi < Pphi < Pi]

Out= {Rr, Ttheta, ArcTan[Cos[Pphi], Sin[Pphi]]}

But I would have thought that for a given Pphi in (-Pi,Pi), there is a
unique value for ArcTan[Cos[Pphi], Sin[Pphi]], which is... Pphi.  And
this seems to me consistent with the fact that a given (single) point
is unique, or, in other words, that to a given (perhaps
not-too-specific) {x,y,z} corresponds a unique {Rr, Ttheta, Pphi}, and
vice versa.

What am I missing here?