Re: Converting between Spherical and Cartesian coordinates
- To: mathgroup at smc.vnet.net
- Subject: [mg53322] Re: Converting between Spherical and Cartesian coordinates
- From: "Astanoff" <astanoff at yahoo.fr>
- Date: Thu, 6 Jan 2005 02:51:56 -0500 (EST)
- References: <crg14d$bg8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Alain, Seems that it does simplify if Pphi (as a latitude) ranges from -Pi/2 to Pi/2 and if you don't allow equalities in coordinate ranges : In[1]:=<<Calculus`VectorAnalysis` In[2]:=SetCoordinates[Spherical] Out[2]=Spherical[Rr,Ttheta,Pphi] In[3]:= Unprotect[CoordinateRanges]; CoordinateRanges[ ]={0<Rr<Infinity, 0<Ttheta<Pi, -Pi/2<Pphi<Pi/2}; Protect[CoordinateRanges]; In[6]:=sph=CoordinatesFromCartesian[{x,y,z}] Out[6]={Sqrt[x^2 + y^2 + z^2], ArcCos[z/Sqrt[x^2 + y^2 + z^2]], ArcTan[x, y]} In[7]:= car=sph /. Thread[{x,y,z} -> CoordinatesToCartesian[{Rr,Ttheta,Pphi}]] Out[7]= {Sqrt[Rr^2*Cos[Ttheta]^2 + Rr^2*Cos[Pphi]^2*Sin[Ttheta]^2 + Rr^2*Sin[Pphi]^2*Sin[Ttheta]^2], ArcCos[(Rr*Cos[Ttheta])/Sqrt[Rr^2*Cos[Ttheta]^2 + Rr^2*Cos[Pphi]^2*Sin[Ttheta]^2 + Rr^2*Sin[Pphi]^2*Sin[Ttheta]^2]], ArcTan[Rr*Cos[Pphi]*Sin[Ttheta], Rr*Sin[Pphi]*Sin[Ttheta]]} In[8]:=car // Simplify[#,CoordinateRanges[ ]]& Out[8]={Rr,Ttheta,Pphi} hth Valeri