Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: concatenating files, slowdown
  • Next by Date: Re: any updates to Mathematica control system professional application?
  • Previous by thread: Converting between Spherical and Cartesian coordinates
  • Next by thread: Re: Converting between Spherical and Cartesian coordinates