Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Dot product confusion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109978] Re: Dot product confusion
  • From: Mark Adler <madler at alumni.caltech.edu>
  • Date: Thu, 27 May 2010 06:44:17 -0400 (EDT)
  • References: <htg90l$k7h$1@smc.vnet.net> <htiviq$2h1$1@smc.vnet.net>

On 2010-05-26 04:10:18 -0700, Roland Franzius said:
> The second product is mathematically incorrect in the context of general
> matrix multiplication because a matrix product of 3x3 . 1x3 does not
> exist.

That vector does not have dimensions 1x3.  Its dimensions are simply 3.
 It is not a 2-dimensional matrix:

Dimensions[{1, 2, 3}]
{3}
Dimensions[{{1, 2, 3}}]
{1, 3}
Dimensions[{{1}, {2}, {3}}]
{3, 1}

Mathematica is being completely consistent on how those are treated for
an inner product, where simply the inner two dimensions must be equal
and are removed:

m = {{1, 2}, {3, 4}};
Dimensions[m]
{2, 2}
Dimensions[{1, 2}.m]
{2}
Dimensions[{{1, 2}}.m]
{1, 2}
Dimensions[m.{1, 2}]
{2}
Dimensions[m.{{1}, {2}}]
{2, 1}

Mathematica does complain about improper matrix products, when the
arguments are in fact matrices, e.g. 2x2 . 1x2:

m.{{1, 2}}
Dot::dotsh: Tensors {{1,2},{3,4}} and {{1,2}} have incompatible shapes.
{{1, 2}, {3, 4}}.{{1, 2}}

Mark


  • Prev by Date: Re: ToExpression[ToString[expr]]=E2=89 _expr
  • Next by Date: Corruption of formulas after cut-and-paste
  • Previous by thread: Re: Dot product confusion
  • Next by thread: ToExpression[ToString[expr]]=E2=89 _expr