Re: RE: Re: Dot Product in Cylindrical Coordinates
- To: mathgroup at smc.vnet.net
- Subject: [mg69351] Re: [mg69301] RE: [mg69276] Re: Dot Product in Cylindrical Coordinates
- From: Pratik Desai <pratikd at wolfram.com>
- Date: Thu, 7 Sep 2006 23:58:49 -0400 (EDT)
- References: <200609060828.EAA12847@smc.vnet.net>
David Park wrote: > 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 > > I think it is quite imperative to note here that "There are often conflicting definitions of a particular coordinate system in the literature. When you use a coordinate system with this package, you should look at the definition given below to make sure it is what you want." --Mathematica Documentation So for cylindrical coordinate system one must define the system as: g = {g?[r, theta, z], g?[r, theta, z], gz[r, theta, z]} f = {f?[r, theta, z], f?[r, theta, z], fz[r, theta, z]} g?[r_, theta_, z_] = r g?[r_, theta_, z_] = theta gz[r_, theta_, z_] = z f?[r_, theta_, z_] = r^2 f?[r_, theta_, z_] = theta fz[r_, theta_, z_] = Cos[z] Then everything works fine: In[20]:= Div[CrossProduct[g,f]]===DotProduct[Curl[g],f]-DotProduct[Curl[f],g] Out[20]= True Hope this helps Pratik
- References:
- RE: Re: Dot Product in Cylindrical Coordinates
- From: "David Park" <djmp@earthlink.net>
- RE: Re: Dot Product in Cylindrical Coordinates