Re: Dot product confusion
- To: mathgroup at smc.vnet.net
- Subject: [mg109963] Re: Dot product confusion
- From: Roland Franzius <roland.franzius at uos.de>
- Date: Wed, 26 May 2010 07:10:56 -0400 (EDT)
- References: <htg90l$k7h$1@smc.vnet.net>
S. B. Gray schrieb: > Given > > ptsa = {{x1, y1, z1}, {x2, y2, z2}, {x3, y3, z3}}; > > I thought the following expressions would be identical: > > {aa, bb, cc}.ptsa (* expression 1 *) > ptsa.{aa, bb, cc} (* expression 2 *) > > but they are not. They evaluate respectively as: > > {aa x1 + bb x2 + cc x3, aa y1 + bb y2 + cc y3, > aa z1 + bb z2 + cc z3} > > {aa x1 + bb y1 + cc z1, aa x2 + bb y2 + cc z2, > aa x3 + bb y3 + cc z3} > > Since ptsa is itself three xyz coordinates, the expressions might be > ambiguous, but I assumed the dot product would always commute. Should > there be a warning? > > The first result is the one I want. The first result is mathematically correct as a matrix product with a left factor a (1x3) matrix and the right factor 3x3 matrix. Nevertheless for working in the index spaces it is better to use {{aa,bb,cc}} for a row vector The second product is mathematically incorrect in the context of general matrix multiplication because a matrix product of 3x3 . 1x3 does not exist. but it is conveniently introduced for abuse of notation by lazy physicists. In the second product the right factor has to be a 3x1 matrix - or a column vector - {{aa},{bb},{cc}} and the result has to be of the same type. Try to Transpose[{aa,bb,bb}] No such problems with Transpose[{{aa,bb,bb}}] -- Roland Franzius