Re: Re: coordinate transformation

*To*: mathgroup at smc.vnet.net*Subject*: [mg13252] Re: [mg13169] Re: [mg13117] coordinate transformation*From*: David Withoff <withoff>*Date*: Fri, 17 Jul 1998 03:17:47 -0400*Sender*: owner-wri-mathgroup at wolfram.com

> S.-Svante Wellershoff wrote: > > > > Can someone explain me, how to use mathematica for transformations > > between > > different coordinate systems? > > > > Like (x,y,z) in carthesian equals (r sin t cos p, r sin t sin p, r cos > > t) in spherical system. > > > > Thanks, Svante > > > > p.s.: hope its no faq! > > > > --------------------------------------------------------------------- > > S.-Svante Wellershoff svante.wellershoff at physik.fu-berlin.de > > http://www.physik.fu-berlin.de/~welle/ > > --------------------------------------------------------------------- > > Institut fuer Experimentalphysik > > Freie Universitaet Berlin phone +49-(0)30-838-6234 (-6057) > > Arnimallee 14 fax +49-(0)30-838-6059 > > 14195 Berlin - Germany > > --------------------------------------------------------------------- > > There is an add-on package which does this called > Calculus`VectorAnalysis`. Please be careful. Your definition above > and the ones built in to mathematica and the ones quoted in nearly > every physics book I have ever seen are valid only for vectors of > infinitesimal spatial extent(field vectors, not displacement vectors) > centered at the origin. You must also transform the unit vectors along > with the components. If you do any subsequent vector differential > operations, you must also take into account the coordinate metric which > depends on the unit system and the location of the vectors. Yes, there are functions in Calculus`VectorAnalysis` to change between common coordinate systems. For example: In[1]:= << Calculus`VectorAnalysis` In[2]:= ?CoordinatesToCartesian CoordinatesToCartesian[pt] gives the Cartesian coordinates of the point pt given in the default coordinate system. CoordinatesToCartesian[pt, coordsys] gives the Cartesian coordinates of the point given in the coordinate system coordsys. In[3]:= CoordinatesToCartesian[{r, t, p}, Spherical] Out[3]= {r Cos[p] Sin[t], r Sin[p] Sin[t], r Cos[t]} The documentation for this and other functions in this package can be found in the Standard Add-On Packages guide, which is included in the on-line documentation. I expect that that is what you want. The remark about transformations that are "valid only for vectors of infinitesimal spatial extent centered at the origin" is confusing, but may refer to the fact that, when working with a vector field, the field vectors are typically described using a locally cartesian coordinate system derived from the coordinate system that is used for the host space. You can get into all sorts of trouble if you get the host space (or the coordinate system that is used to describe it) mixed up with the spaces (or their coordinate systems) used for the field vectors. If you aren't working with vector fields, then none of that is relevant, of course, and it isn't relevant to the Calculus`VectorAnalysis` package in any case, since the functions in that package only deal with one space at a time, and are not intended for transformations between, say, one locally cartesian space and another. Dave Withoff Wolfram Research