第五题--生成各种矩阵的方式
![Mathematica入门习题[5]–各种矩阵的生成方式(单位矩阵,对角矩阵,分块矩阵)](https://img.mathpretty.com/snipaste_20170912_215241.png)
- Clear["Global`*"];
- e = IdentityMatrix[3];(*生成单位矩阵*)
- r = RandomReal[3, {3, 2}];
- o = Table[0, {2}, {3}];
- s = DiagonalMatrix[{k1, k2}];(*生成对角矩阵*)
- a = ArrayFlatten[{{e, r}, {o, s}}];
- aa = a.a;
- aaa = ArrayFlatten[{{e, r + r.s}, {o, s.s}}];
- Column[MatrixForm[#] & /@ {e, r, o, s, a, aa, aaa, aa - aaa},
- Spacings -> 1.5]
![Mathematica入门习题[5]–各种矩阵的生成方式(单位矩阵,对角矩阵,分块矩阵)](https://img.mathpretty.com/snipaste_20170912_220130.png)
- 微信公众号
- 关注微信公众号
-
- QQ群
- 我们的QQ群号
-
评论