Forgot password?
 Register account
View 1343|Reply 1

Mathematica构造下三角矩阵

[Copy link]

459

Threads

952

Posts

9843

Credits

Credits
9843

Show all posts

青青子衿 Posted 2019-4-30 18:06 |Read mode
方法一:用稀疏数组(SparseArray)命令
...
  1. SparseArray[{i_, j_} /; i >= j -> Subscript[a, i, j], {10, 10}] // MatrixForm
Copy the Code
...
方法二:用下三角+数组(LowerTriangularize+Array)命令
...
  1. LowerTriangularize[Array[Subscript[a, #1, #2] &, {10, 10}]] // MatrixForm
Copy the Code
...
方法三:用表格+如果(Table+If)命令
...
  1. Table[If[i >= j, Subscript[a, i, j], 0], {i, 10}, {j, 10}] // MatrixForm
Copy the Code

reference.wolfram.com/language/tutorial/ConstructingMatrices.html

459

Threads

952

Posts

9843

Credits

Credits
9843

Show all posts

 Author| 青青子衿 Posted 2019-5-6 23:33
回复 1# 青青子衿
应用案例:
  1. NN = 5;
  2. Aa = Table[If[i > j, -1, 0], {i, NN}, {j, NN}] +
  3.    DiagonalMatrix[Array[Subscript[a, #] &, {NN}]] +
  4.    DiagonalMatrix[Range[NN - 1], 1];
  5. Bb = Table[If[i > j, -1, 0], {i, NN}, {j, NN}] +
  6.    DiagonalMatrix[Reverse[Array[Subscript[a, #] &, {NN}]]] +
  7.    DiagonalMatrix[Reverse[Range[NN - 1]], 1];
  8. Aa // MatrixForm
  9. Det[Aa] // Factor
  10. Bb // MatrixForm
  11. Det[Bb] // Factor
Copy the Code

Mobile version|Discuz Math Forum

2025-6-5 01:47 GMT+8

Powered by Discuz!

× Quick Reply To Top Edit