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: VECTOR coordinate transformation?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61320] Re: [mg61242] VECTOR coordinate transformation?
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 14 Oct 2005 22:23:17 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Not exactly, but it is easy to generate the conversion, at least from
spherical to Cartesian.

Define the Cartesian components of a point in spherical coordinates. Here r
is the radius from the origin, phi is the colatitude (angle from the z axis)
and theta is the longitude.

p[r_, \[Phi]_, \[Theta]_] = r*{Sin[\[Phi]]*Cos[\[Theta]],
    Sin[\[Phi]]*Sin[\[Theta]], Cos[\[Phi]]}

To calculate the vector transformation from spherical to Cartesian
coordinates we just calculate the Jacobian matrix of the point function with
respect to the spherical coordinates. We can do that with Outer.

sphericalToCartesian[r_, \[Phi]_, \[Theta]_] =
  Outer[D[#1, #2] & , p[r, \[Phi], \[Theta]], {r, \[Phi], \[Theta]}]

{{Cos[\[Theta]]*Sin[\[Phi]], r*Cos[\[Theta]]*Cos[\[Phi]],
   (-r)*Sin[\[Theta]]*Sin[\[Phi]]}, {Sin[\[Theta]]*Sin[\[Phi]],
   r*Cos[\[Phi]]*Sin[\[Theta]], r*Cos[\[Theta]]*Sin[\[Phi]]},
  {Cos[\[Phi]], (-r)*Sin[\[Phi]], 0}}

Let's convert the vector at spherical coordinates {1,Pi/2,0} with spherical
components {1,0,0}. We just multiply the matrix times the vector.

sphericalToCartesian[1, Pi/2, 0] . {1, 0, 0}
{1, 0, 0}

If you want to go the other way you have to invert the matrix. And if you
want the transformation matrices to be expressed in Cartesian coordinates it
takes a little work.

This can probably be done more elegantly with a tensor calculus program.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/




From: na [mailto:na at na.na.com]
To: mathgroup at smc.vnet.net


Hello,
Is there any built-in command in Mathematica, which converts a vector's
coordinate system say from Cartesian to Spherical, or Spherical to
Cylindrical?  By the way, I know about CoordinatesToCartesian[] and
CoordinatesFromCartesian[] already, and those are for "points" not
"vectors".  I'd like to know if there an equivalent command for VECTORS.
Thank you for your help!



  • Prev by Date: Re: Problem with circles in complex plane
  • Next by Date: Re: Solving Diophantine Equations
  • Previous by thread: VECTOR coordinate transformation?
  • Next by thread: Surface plot from level curves