MathGroup Archive 2006

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

Search the Archive

Re: Can't multiply non-square matrices.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64573] Re: Can't multiply non-square matrices.
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 23 Feb 2006 00:34:07 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <dthgr4$n74$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Chris Young wrote:
> Is there a way to multiply non-square matrices? E.g., a 3-row by 2-row 
> matrix times a 2-row by 1-row matrix should yield a 3-row by 1-row 
> matrix, if I remember my linear algebra correctly.
> 
> Instead when I do something like
> 
>    (a  b) (c)
>           (d)
> 
> I get an error involving "Thread::tdlen":
> 
> Thread::tdlen: Objects of unequal length in {{a, b}}\{{c}, {d}} cannot be \
> combined.
> 
> (The "(c)" and "(d)" above represent a 2-dimensional column vector, 
> with one pair of parenthese around them.)
> 
> I entered the line
> << LinearAlgebra`MatrixManipulation`
> but this doesn't seem to help.
> 
> Any help appreciated.
> 
> Chris Young
> 
Hi Chris,

Your row vector {a, b} has extraneous parentheses around it.

In[1]:=
{{a,b}} {{c},{d}}

Thread::tdlen: Objects of unequal length in {{a, b}}\{{c}, {d}} cannot 
be combined.

Out[1]=
{{a,b}} {{c},{d}}

Compare with

In[2]:=
{a,b} {{c},{d}}

Out[2]=
{{a c},{b d}}

In[3]:=
{a,b}.{{c},{d}}

Out[3]=
{a c+b d}

In[4]:=
{a,b}.{c,d}

Out[4]=
a c+b d

In[5]:=
{a,b} {c,d}

Out[5]=
{a c,b d}

Best regards,
/J.M.


  • Prev by Date: Re: Matrix multiplication problem fixed via dot operation.
  • Next by Date: Re: Combining ContourPlot and Plot
  • Previous by thread: Re: Re: Can't multiply non-square matrices.
  • Next by thread: Re: Can't multiply non-square matrices.