MathGroup Archive 2004

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

Search the Archive

Re: [Outer [Times, , ] ] Question


Hi,

You need to get rid of MatrixForm when assigning m1, m2, m3:

{m1,m2,m3} =
    MapThread[
       Outer[Times, #1, #2] & , {{x1, x2, x3}, {y1, y2, y3}}
    ];

MatrixForm[ Plus @@ {m1,m2,m3} ]

Sasha

MichaelSMcCain at cs.com wrote:

> Hi:
> 
> I want to take a Column Vector and multiply it by a Row Vector to create an 
> "Outer" Matrix. 
> 
> In other words, I want to take a 5x1 Column Vector and multiply it by a 1x4 
> Row Vector and output a 5x4 Matrix.
> 
> I then want to add several of these Matrices together and obtain a "final" 
> Matrix.
> 
> I tried the following:
> 
> x1 = {1, -1, -1, 1, 1};
> y1 = {1, 1, -1, -1};
> 
> x2 = {-1, 1, -1, 1, -1};
> y2 = {1, -1, 1, -1};
> 
> x3 = {1, 1, -1, -1, 1};
> y3 = {-1, -1, 1, 1};
> 
> m1 = MatrixForm[Outer [Times, x1, y1] ]
> m2 = MatrixForm[Outer [Times, x2, y2] ]
> m3 = MatrixForm[Outer [Times, x3, y3] ]
> 
> mm = m1 + m2 + m3
> 
> MatrixForm[mm]
> 
> The output that I get is incorrect and does not combine into a single Matrix.
> 
> 
> What am I doing wrong?
> 
> Thanks,
> 
> 
> Mike McCain
> MichaelSMcCain at cs.com
> 


  • Prev by Date: Re: [Outer [Times, , ] ] Question
  • Next by Date: Re: FilledPlot with Implicit Functions?
  • Previous by thread: Re: [Outer [Times, , ] ] Question
  • Next by thread: Re: [Outer [Times, , ] ] Question