Re: Help on use of Packages
- To: mathgroup at smc.vnet.net
- Subject: [mg2187] Re: Help on use of Packages
- From: danl (Daniel Lichtblau)
- Date: Fri, 13 Oct 1995 02:23:58 -0400
- Organization: Wolfram Research, Inc.
In article <45d1te$63m at ralph.vnet.net> zheng at risky.ecs.umass.edu (Yuan
Zheng) writes:
> Hi,
>
> I have the following problem when I use the
LinearAlgebra`MatrixManipulation
> Package. I also use Math2.2 for DOS and wnmath2.2 notebook. All of them
have
> the same result.
>
> I am new to the Mathematica. Are there something I am doing wrong? I
followed
> the exact procedure described on pp 218-219 in the book Guide to
Standard
> Mathematica Packages Version 2.2.
>
> I need to do a lot of matrix manipulations in my symbolic computation.
Could
> somebody help me to solve this problem?
>
>
> Thanks
>
>
> Yuan Zheng
> Dept of Mechanical Engineering
> Umass, Amherst
>
>
>
> The following is the screen display.
>
>
>
> ===============================================
> Mathematica 2.2 for DEC RISC
> Copyright 1988-93 Wolfram Research, Inc.
> -- Terminal graphics initialized --
>
> In[1]:=
> In[2]:= a = {{a11,a12},{a21,a22}}//MatrixForm
> Out[2]//MatrixForm= a11 a12
>
> a21 a22
>
> In[3]:= b = {{b11,b12},{b21,b22}}//MatrixForm
> Out[3]//MatrixForm= b11 b12
>
> b21 b22
>
> In[4]:= cc = AppendColumns[a,b]//MatrixForm
> Out[4]//MatrixForm= AppendColumns[a11 a12, b11 b12]
>
> a21 a22 b21 b22
>
> In[5]:= Dimensions[cc]
> Out[5]= {1}
>
> In[6]:= dd = AppendRows[a,b]//MatrixForm
> Out[6]//MatrixForm= AppendRows[a11 a12, b11 b12]
>
> a21 a22 b21 b22
>
> In[7]:= Dimensions[dd]
> Out[7]= {1}
>
> In[8]:= ee = BlockMatrix[ { {a,b},{b, {{0,0},{0,0}}}}]//MatrixForm
> Out[8]//MatrixForm=
>
> AppendColumns[AppendRows[a11 a12, b11 b12],
>
> > a21 a22 b21 b22
>
> > AppendRows[b11 b12, {{0, 0}, {0, 0}}]]
>
> b21 b22
>
> In[9]:= Dimensions[ee]
> Out[9]= {1}
>
> In[10]:= Quit
>
The problem is that // has higher precedence than = and hence it gets
put on the matrix as a head before the set assignment is done. That is,
you do
In[55]:= a = {{a11,a12},{a21,a22}}//MatrixForm
Out[55]//MatrixForm= a11 a12
a21 a22
and you get something with Head of MatrixForm:
In[56]:= FullForm[a]
Out[56]//FullForm= MatrixForm[List[List[a11, a12], List[a21, a22]]]
If instead you do, say,
In[57]:= (aa = {{a11,a12},{a21,a22}})//MatrixForm
Out[57]//MatrixForm= a11 a12
a21 a22
then you get what you want.
In[58]:= FullForm[aa]
Out[58]//FullForm= List[List[a11, a12], List[a21, a22]]
Daniel Lichtblau, WRI
danl at wri.com