MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: vectors in polar coordinates



Michael Milirud wrote:
> 
> I'm really lost here. It seems there is almost NO support of simple
> vectors in Mathematica v.3.0
> If I want to add 2 vectors of which I have a polar (cylindrical)
> representation I am forced to do something like
> 
> << Calculus`VectorAnalysis`
> SetCoordinates[Cylindrical]
> a={100, -115*Pi/180, 0}
> b={200, -30*Pi/180, 0}
> A=CoordinatesToCartesian[a, Cylindrical] B=CoordinatesToCartesian[b,
> Cylindrical] d=A+B
> D=CoordinatesFromCartesian[d, Cylindrical]
> 
> and that is a HECK longer to do then by hand. There's got to be
> something simplier like:
> {100, -115*Pi/180, 0} + {200, -30*Pi/180, 0}
> 
> or something...
> 
> Also how do I find a magnitude of a vector. The Abs[] doesn't support
> this. Sqrt[d[[1]]^2+d[[2]]^2+d[[3]]^2]
> 

Michael,

There may be an off-the-shelf answer, but we can define the needed
functions and store their definitions in  file or a notebook (or extend
the Calculus`VectorAnalysis` Add-on)

<<Calculus`VectorAnalysis`

SetCoordinates[Cylindrical];

a={100, -115*Pi/180, 0}
b={200, -30*Pi/180, 0}

cylPlus[x___]:=
CoordinatesFromCartesian[
    Plus@@(CoordinatesToCartesian[#, Cylindrical]&/@{x}),
		Cylindrical]

cylPlus[a,b]

                             23 Pi  2 {Sqrt[(100 Sqrt[3] + 100
Cos[-----])  + 
                              36
 
                    23 Pi  2
    (-100 - 100 Sin[-----]) ], 
                     36
 
                           23 Pi
            -100 - 100 Sin[-----]
                            36
  ArcTan[----------------------------], 0}
                               23 Pi
         100 Sqrt[3] + 100 Cos[-----]
                                36

Norm[x_] := Sqrt[x.x]

cylNorm[x_] := First[x]

cylNorm[a]

-- 
Allan Hayes
Mathematica Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642




  • Prev by Date: mathematica crashing triteal cde on linux...?
  • Next by Date: Re: Integer designation
  • Prev by thread: vectors in polar coordinates
  • Next by thread: Re: vectors in polar coordinates