基本概念:
转置矩阵:
如果把mn阶矩阵的第i行改为第i列,第j列改为第j行,就可得到一个新的nm矩阵,记作,称为A的转置(矩阵),具体表示如下
若,则
显然,n阶方阵的转置仍是n阶方阵,而且对任何矩阵A,有
矩阵的乘法:
设分别是m×n, n×p矩阵,则矩阵A与B的乘积是一m×p矩阵,记为
,
其中乘积矩阵C中第i行第k列处元素为
,
并非任何两个矩阵都可以进行: 一个基本的条件是A的列数必须与B的行数相同
矩阵的乘法是不可交换的,或者说,交换之后结果通常不同。
单位矩阵:
它是个方阵,除左上角到右下角的对角线(称为主对角线)上的元素均为1以外全都为0,即.
逆矩阵:
设A是n阶方阵,若存在n阶矩阵B使得AB=BA=In,则称A是可逆的,或说A是可逆矩阵,而B称为A的逆矩阵.可以证明,这样的逆矩阵是唯一的,因此可记为A-1,而且只需要B满足一个方程AB=In或BA=In就是A的逆了.
基本语法:
The following statement assigns a 3 × 2 matrix literal to the matrix Z:
z={1 2, 3 4, 5 6};
Here is the resulting matrix:
Z
1 2
3 4
5 6
The following statement creates a matrix W that is three times the matrix Z:
w=3#z;
Here is the resulting matrix:
W
3 6
9 12
15 18
A repetition factor can be placed in brackets before a literal element to have the
element repeated. For example, the following two statements are equivalent:
answer={[2] ’Yes’, [2] ’No’};
answer={’Yes’ ’Yes’, ’No’ ’No’};
J function: J( nrow<,ncol<,value> > );
I function: I( dimension );
Index vector:
> r=1:5;
R
1 row 5 cols (numeric)
1 2 3 4 5
> s=10:6;
S
1 row 5 cols (numeric)
10 9 8 7 6
> t=’abc1’:’abc5’;
T
1 row 5 cols (character, size 4)
abc1 abc2 abc3 abc4 abc5
解方程组:
3x1 − x2 + 2x3 = 8
2x1 − 2x2 + 3x3 = 2
4x1 + x2 − 4x3 = 9
proc iml;
reset print;
a={3 -1 2,
2 -2 3,
4 1 -4};
c={8,2,9};
x=inv(a)*c;
quit;
解为3,5,2