Re: Vectors and Mathematica
- To: mathgroup@smc.vnet.net
- Subject: [mg11778] Re: [mg11760] Vectors and Mathematica
- From: Sean Ross <seanross@worldnet.att.net>
- Date: Sat, 28 Mar 1998 00:25:16 -0500
- References: <199803260809.DAA06319@smc.vnet.net.>
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] > > is simply hedious!!! > > Please help cause I'm really lost ;( > > Michael > > P.S. If possible, please also send a direct email to > mmichael@idirect.com Remember that mathematica is NOT A PROGRAM! IT IS A PROGRAMMING LANGUAGE. If you want a certain kind of function or multiplication, then write it. Do not expect everything that you want to do to be solvable with one line functions or built-in commands. If you want that, then you need MathCAD, but you will pay a huge price in functionality. Once you have figured out how to add cylindrical vectors, then make a function called cylindricaladd[v1,v2] that will do it for you. As far as the magnitude of a vector, I think Sqrt[v1.v2] is the simplest. The "." is shorthand for Dot[] and is the vector dot product. There is also a Calculus`VectorAnalysis` package with Unit system specific Dot, Cross and Triple product functions. Based on your examples, it seems like you are assuming that the vectors are positioned at the origin and are of infinitesimal spatial extent. As long as you are content with this, then no special treatment is required, but in general, remember that operations in non-cartesian coordinate systems are deceptively tricky and that textbooks don't often cover the subtleties of how to add, subtract and multiply vectors. At least, my graduate level physics courses blew by the topics and some authors never even considered these basic operations. When you write a vector in polar form as an ordered triplet, you are leaving out half of the information about the vector. Since the basis vectors are a function of position, a complete description of a vector in non-cartesian coordinates must also include the coordinates the vector is at! Furthermore, since the basis vectors are a function of position, standard addition is only valid for vectors which represent vector fields of some kind and are of infinitesimal spatial extect so that the entire vector can be represented by one set of unit vectors. If the vector represents displacement, then each point along the vector has a different set of unit vectors and integration along the path of the vectors is required to add them or perform any other kind of operations on them. -- Remove the _nospam_ in the return address to respond.
- References:
- Vectors and Mathematica
- From: "Michael Milirud" <michael@idirect.com>
- Vectors and Mathematica