Message Boards Message Boards

0
|
9344 Views
|
8 Replies
|
1 Total Likes
View groups...
Share
Share this post:

norm of a cylindrical vector?

Posted 10 years ago

The angle of a cylindrical vector should not contribute to its length, so I was expecting the root of 25, or 5. Where did I go wrong? Mathematica 9 newbie

SetCoordinates[Cylindrical[r, \[Theta], z]]
CoordinateSystem
w = {3, 2, 4}
Norm[w]
(w . w)^.5
CoordinateSystem

I get;

Cylindrical[r, \[Theta], z]
Cylindrical
{3, 2, 4}
Sqrt[29]
5.38516
Cylindrical
POSTED BY: T Zintel
8 Replies

The code you have requires loading the old package. The built-in vector analysis functions have different names or different ways to obtain the same output. See http://reference.wolfram.com/language/Compatibility/tutorial/VectorAnalysis.html or its built-in equivalent, Compatibility/tutorial/VectorAnalysis under Help - Wolfram Documentation.

The above tutorial suggests replacing DotProduct from the old package with a user function that converts the vectors to Cartesian, then takes the ordinary Dot product.

In[1]:= dotProduct[a_, b_, chart_] := 
 CoordinateTransform[chart -> "Cartesian", a].CoordinateTransform[ chart -> "Cartesian", b]

In[2]:= dotProduct[{3, 2, 4}, {3, 2, 4}, "Cylindrical"] // N

Out[2]= 25.

Using the package works for me with 10.0.0 and 10.0.1.

In[1]:= Needs["VectorAnalysis`"]

General::obspkg: VectorAnalysis` is now obsolete. The legacy version being loaded may conflict with
     current functionality. See the Compatibility Guide for updating information.

In[2]:= DotProduct[{3, 2, 4}, {3, 2, 4}, Cylindrical]

                     2           2
Out[2]= 16 + 9 Cos[2]  + 9 Sin[2]

In[3]:= Simplify[%]

Out[3]= 25

In[4]:= $Version

Out[4]= 10.0 for Microsoft Windows (64-bit) (June 29, 2014)

The attached notebook has three examples - your code without loading the package, your code after loading the package, and the new method.

Attachments:
POSTED BY: Bruce Miller
Posted 10 years ago

This question fell from strange cylindrical results as well. The problem I'm working is naturally cylindrical. I set Coords to Cyl and got to work. When I noticed things were not coming out as expected I started back tracking and found my Dots were not working correctly.

The w of 3,2,4 was fabricated as a test of Dot because it would give obvious results in Cyl & Cart coordinates. I did see good documentation on translating between coordinate systems, but that really doesn't suit my needs for this case.

Can I get someone to confirm if the above snippet does / doesn't work for them in mathematica 10?

POSTED BY: T Zintel

I've sometimes gotten strange results with spherical or cylindrical coordinates. These can be avoided by transforming to good old Cartesian coordinates. With x=r cos\theta, y=r sin\theta, z=z , wcyl={3,2,4} becomes wcart={3 cos(2), 3 sin(2), 4} , etc. Do you really have theta=2 radians? Actually, it looks like w={3,2,4} is already in Cartesian coordinates, so w.w=29.

POSTED BY: S M Blinder

Unless I'm missing something obvious....I'm stumped

Posted 10 years ago

Thanks for the quick replies. I did a unistall / reinstall / upgrade before my last message hoping it would help as well. Today I tried a fresh installation of 10.0.1.0 on a linux machine expecting that too clear things up. Surprisingly it didn't.

I open a new notebook, execute:

SetCoordinates[Cylindrical[r, \[Theta], z]]
CoordinateSystem
w = {3, 2, 4}
Norm[w]
(w.w)^.5
CoordinateSystem
DotProduct[{3, 2, 4}, {3, 2, 4}, Cylindrical]

and get:

SetCoordinates[Cylindrical[r, \[Theta], z]]
CoordinateSystem
{3, 2, 4}
Sqrt[29]
5.38516
CoordinateSystem
DotProduct[{3, 2, 4}, {3, 2, 4}, Cylindrical]

All the Coordinate system command appear to go unrecognized?

Any thoughts?

POSTED BY: T Zintel
Posted 10 years ago

I'm still getting the same thing. As you can see Mathematica does not appear to be recognizing any vector calculus statements. I upgraded to 10.1 but it didn't help.

DotProduct[{3, 2, 4}, {3, 2, 4}, Cylindrical] 

Just echoed like other non recognized commands.

If I execute

`Needs["VectorAnalysis`"]`

I get closer, but still wrong and kinda going in the wrong direction.

What am I missing?

POSTED BY: T Zintel

The upgrade was unnecessary (at least for this question) as I am using version 7. With version 10 , you dont need to use the Needs ["VectorAnalysis"] as this functionality is already included

DotProduct[{3,2,4},{3,2,4},Cylindrical]//N

this should give you the answer you need / expect .

Not sure why you are getting this problem, but I would consider re-installing Mathematica

http://reference.wolfram.com/language/VectorAnalysis/ref/DotProduct.html

DotProduct seems to give the answer you are expecting

DotProduct[{3,2,4},{3,2,4},Cylindrical]//N

25

Since you have already set the coordinate system., including the "Cylindrical" option is optional

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract