MathGroup Archive 1995

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

Search the Archive

Re: SYMBOLIC CONVERSION BETWEEN COORDINATE SYSTEMS:


---------------------------------------------------------
FROM: Luis Aguilar: SMTP%"aguilar at bufadora.astrosen.unam.mx"

SYMBOLIC CONVERSION BETWEEN COORDINATE SYSTEMS: I have a spatial scalar
function expressed in spherical coordinates. How can I get iso-surfaces ( or
iso-contours for 2D cuts), if the usual contouring routines assume that your
function is expressed in cartesian coordinates? 

I also need to plot the vectorfield produced by the gradient of this function.
Although the `VectorAnalysis` package allows me to obtain the gradient, I'm
stuck with the conversion of coordinates problem when attempting to use the
PlotVectorField command.
---------------------------------------------------------
Luis, There is a useful trick for converting between coordinate
systems that should help solve part of your problem. You can find this trick,
and others,  in  Chapter 1 of MATHEMATICA FOR PHYSICS by Zimmerman & Olness  
(Addison-Wesley Pub. Co.; MathSource Number: 0206-862)

Fredrick I. Olness, Olness at mail.physics.smu.edu
---------------------------------------------------------
*** LOAD THE PACKAGE
Needs["Calculus`VectorAnalysis`"];

*** TO CONVERT TO ANY MATHEMATICA COORDINATE SYSTEM
Thread[{x,y,z}-> CoordinatesToCartesian[{r,theta,phi},Spherical] ]

   {x -> r Cos[phi] Sin[theta], y -> r Sin[phi] Sin[theta], z -> r Cos[theta]}

*** TO CONVERT FROM ANY MATHEMATICA COORDINATE SYSTEM
Thread[{r,theta,phi}-> CoordinatesFromCartesian[{x,y,z},Spherical] ]

               2    2    2                           z
   {r -> Sqrt[x  + y  + z ], theta -> ArcCos[------------------], 
                                                   2    2    2
                                             Sqrt[x  + y  + z ]
     phi -> ArcTan[x, y]}

*** LET'S TRY SOMETHING EXOTIC
Thread[{x,y,z}->
  CoordinatesToCartesian[
     Coordinates[EllipticCylindrical]
       ,EllipticCylindrical] ]

   {x -> Cos[v] Cosh[u], y -> Sin[v] Sinh[u], z -> z}
---------------------------------------------------------



  • Prev by Date: Re: Greek characters in label
  • Next by Date: Re: Question
  • Previous by thread: SYMBOLIC CONVERSION BETWEEN COORDINATE SYSTEMS:
  • Next by thread: stem function of Matlab?