Re: SYMBOLIC CONVERSION BETWEEN COORDINATE SYSTEMS:
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg464] Re: [mg451] SYMBOLIC CONVERSION BETWEEN COORDINATE SYSTEMS:
- From: olness at phyvms.physics.smu.edu
- Date: Mon, 13 Feb 1995 16:11:29 -0600
--------------------------------------------------------- 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} ---------------------------------------------------------