RE: Re: Dot Product in Cylindrical Coordinates
- To: mathgroup at smc.vnet.net
- Subject: [mg69302] RE: [mg69276] Re: Dot Product in Cylindrical Coordinates
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 6 Sep 2006 04:28:12 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
And actually in the second example I should have used CrossProduct, in which case it even more doesn't work. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ Paul, I want to expand a little more on my previous posting. The point is that the VectorAnalysis does expect that the components of a vector are given in the orthornormal frame in Curl and Divergence. So it is a little quixotic to switch the context when using DotProduct and CrossProduct. Needs["Calculus`VectorAnalysis`"] SetCoordinates[Cylindrical[\[Rho], \[Phi], z]]; Here is a theorem from vector calculus: div[g x f] == curl[g].f - curl[f].g Which dot product is meant? If we use the ordinary Dot product the theorem is true. Div[Cross[{g\[Rho][\[Rho], \[Phi], \[Theta]], g\[Phi][\[Rho], \[Phi], \[Theta]], gz[\[Rho], \[Phi], \[Theta]]}, {f\[Rho][\[Rho], \[Phi], \[Theta]], f\[Phi][\[Rho], \[Phi], \[Theta]], fz[\[Rho], \[Phi], \[Theta]]}]] == DotProduct[ Curl[{g\[Rho][\[Rho], \[Phi], \[Theta]], g\[Phi][\[Rho], \[Phi], \[Theta]], gz[\[Rho], \[Phi], \[Theta]]}], {f\[Rho][\[Rho], \[Phi], \[Theta]], f\[Phi][\[Rho], \[Phi], \[Theta]], fz[\[Rho], \[Phi], \[Theta]]}] - DotProduct[ Curl[{f\[Rho][\[Rho], \[Phi], \[Theta]], f\[Phi][\[Rho], \[Phi], \[Theta]], fz[\[Rho], \[Phi], \[Theta]]}], {g\[Rho][\[Rho], \[Phi], \[Theta]], g\[Phi][\[Rho], \[Phi], \[Theta]], gz[\[Rho], \[Phi], \[Theta]]}]; % // Simplify True If instead we use the VectorAnalysis DotProduct the theorem is not true. Div[Cross[{g\[Rho][\[Rho], \[Phi], \[Theta]], g\[Phi][\[Rho], \[Phi], \[Theta]], gz[\[Rho], \[Phi], \[Theta]]}, {f\[Rho][\[Rho], \[Phi], \[Theta]], f\[Phi][\[Rho], \[Phi], \[Theta]], fz[\[Rho], \[Phi], \[Theta]]}]] == DotProduct[ Curl[{g\[Rho][\[Rho], \[Phi], \[Theta]], g\[Phi][\[Rho], \[Phi], \[Theta]], gz[\[Rho], \[Phi], \[Theta]]}], {f\[Rho][\[Rho], \[Phi], \ \[Theta]], f\[Phi][\[Rho], \[Phi], \[Theta]], fz[\[Rho], \[Phi], \[Theta]]}] - DotProduct[ Curl[{f\[Rho][\[Rho], \[Phi], \[Theta]], f\[Phi][\[Rho], \[Phi], \[Theta]], fz[\[Rho], \[Phi], \[Theta]]}], {g\[Rho][\[Rho], \[Phi], \ \[Theta]], g\[Phi][\[Rho], \[Phi], \[Theta]], gz[\[Rho], \[Phi], \[Theta]]}]; % // Simplify (output omitted) This is certainly a 'feature' and I think it is an error in design. The user should at least be warned about the change in context and meaning. The documentation uses the phrase 'in the default coordinate system' in both DotProduct and in Curl so one could become easily confused. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Paul Abbott [mailto:paul at physics.uwa.edu.au] To: mathgroup at smc.vnet.net In article <edadqd$pgc$1 at smc.vnet.net>, Sergio Miguel Terrazas Porras <sterraza at uacj.mx> wrote: > When I calculate the dot product of vectors {1,Pi/4,0} and {2,0,1} in > Cylindrical Coordinates Mathematica 5.1 returns the result Sqrt[2], when the > result should be 2. Notwithstanding several of the other responses, the result _is_ Sqrt[2]. When you write {1,Pi/4,0}, surely you mean {rho, phi, z} == {1, Pi/4, 0} and _not_ that {x, y, z} == {1, Pi/4, 0} ? After loading Needs["Calculus`VectorAnalysis`"] and selecting Cylindrical coordinates, SetCoordinates[Cylindrical]; then in cartesian coordinates, this point is p1 = CoordinatesToCartesian[{1, Pi/4, 0}] {1/Sqrt[2], 1/Sqrt[2], 0} Similarly, p2 = CoordinatesToCartesian[{2, 0, 1}] {2, 0, 1} Hence the dot product of the coordinate vectors (relative to the origin {0,0,0}), computed in cartesian coordinates, is p1 . p2 Sqrt[2] This is the same result that you got, presumably using, DotProduct[ {1, Pi/4, 0}, {2, 0, 1} ] Sqrt[2] Of course, if you really mean {x, y, z} == {1, Pi/4, 0} then there is no need to load Calculus`VectorAnalysis`: the dot product is just {1, Pi/4, 0} . {2, 0, 1} 2 Note that Dot is _not_ modified when this package is loaded so Jean-Marc's response, Needs["Calculus`VectorAnalysis`"] SetCoordinates[Cylindrical]; {1, Pi/4, 0} . {2, 0, 1} is bogus -- the first two lines have no effect on the third. Modifying Andrzej's code, we have Simplify[(JacobianMatrix[] . p1) . (JacobianMatrix[] . p2)] Sqrt[2] Cheers, Paul _______________________________________________________________________ Paul Abbott Phone: 61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) AUSTRALIA http://physics.uwa.edu.au/~paul