Re: [Outer [Times, , ] ] Question
- To: mathgroup at smc.vnet.net
- Subject: [mg45827] Re: [mg45790] [Outer [Times, , ] ] Question
- From: Yasvir Tesiram <tesiramy at omrf.ouhsc.edu>
- Date: Mon, 26 Jan 2004 01:53:40 -0500 (EST)
- References: <200401250804.DAA19360@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, There was a discussion on MatrixForm and evaluation recently. And here is an example where it is simply inconvenient. See those threads in the archive for a better explanation and ways to evaluate with MatrixForm display throghout. A rule I follow is, use MatrixForm only when you want to visualize the matrix in a Textbook form. It's not really necessary for calculations. Get rid of the MatrixForm in m1, m2 and m3. Do the calculations for mm and then display the result in MatrixForm. I get In[15]:= mm=m1+m2+m3 Out[15]= {{-1, 1, -1, 1}, {-1, -3, 3, 1}, {-1, 1, -1, 1}, {3, 1, -1, -3}, > {-1, 1, -1, 1}} In[16]:= MatrixForm[mm] Out[16]//MatrixForm= -1 1 -1 1 -1 -3 3 1 -1 1 -1 1 3 1 -1 -3 -1 1 -1 1 Cheers Yas On Sun, 25 Jan 2004 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 >
- References:
- [Outer [Times, , ] ] Question
- From: MichaelSMcCain@cs.com
- [Outer [Times, , ] ] Question