Re: Vectors and Mathematica
- To: mathgroup@smc.vnet.net
- Subject: [mg11789] Re: [mg11760] Vectors and Mathematica
- From: Bob Hanlon <BobHanlon@aol.com>
- Date: Sat, 28 Mar 1998 00:25:24 -0500
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]