Forgot password?
 Create new account
View 1227|Reply 1

Mathematica构造下三角矩阵

[Copy link]

462

Threads

969

Posts

9934

Credits

Credits
9934

Show all posts

青青子衿 Posted at 2019-4-30 18:06:59 |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

462

Threads

969

Posts

9934

Credits

Credits
9934

Show all posts

 Author| 青青子衿 Posted at 2019-5-6 23:33:56
回复 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|Leisure Math Forum

2025-4-20 22:23 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list