Re: [Outer [Times, , ] ] Question
- To: mathgroup at smc.vnet.net
- Subject: [mg45824] Re: [Outer [Times, , ] ] Question
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Mon, 26 Jan 2004 01:53:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 1/25/04 at 3:04 AM, MichaelSMcCain at cs.com wrote:
> 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};
<snip>
> m1 = MatrixForm[Outer [Times, x1, y1] ]
The problem is your usage of MatrixForm here. MatrixForm adds a wrapper to the matrix. But that means Mathematica no longer sees m1 as a matrix. That is
MatrixQ[m1]
False
if you get rid of the MatrixForm all will work as you want. If you want to display the matrix as a traditional matrix you can either set the default format type as Traditional Form or do the following
MatrixForm[m1=Outer[Times, x1, y1]]
As an aside you don't need Outer to perform this task. All you need is
Transpose at {x1}.{y1}
That is define the two things to be multiplied as matrices and use the built in matrix multiplication operator ".".
--
To reply via email subtract one hundred and four