MathGroup Archive 1998

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

Search the Archive

Re: Vectors and Mathematica



Needs["Calculus`VectorAnalysis`"]

Define the function once and call as often as required

coordAdd[x_List, y_List, coordSys_] := Module[{X, Y}, 
    X = CoordinatesToCartesian[x, coordSys]; 
    Y = CoordinatesToCartesian[y, coordSys]; 
    CoordinatesFromCartesian[X + Y, coordSys]]

The magnitude of a vector is just the Sqrt of its Dot product

mag[x_List] := Sqrt[x . x]

X = Array[x, 3]; 

mag[X]

Sqrt[x[1]^2 + x[2]^2 + x[3]^2]

Bob Hanlon
In a message dated 3/26/98 8:35:20 AM, michael@idirect.com 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]



  • Prev by Date: Re: Using Mathematica results in publications
  • Next by Date: Re: Animation?
  • Prev by thread: Re: Vectors and Mathematica
  • Next by thread: Re: Vectors and Mathematica