Forgot password
 Register account
View 15|Reply 2

不能写出完整的矩阵,要如何用Mathematica来运算?

[Copy link]

414

Threads

1638

Posts

14

Reputation

Show all posts

abababa posted 2025-6-21 14:43 |Read mode
thread-14001-1-1.html
原题目如上链接,具体的矩阵(行列式)如下:
\[
\begin{vmatrix}
\binom{n+m}{n} & \binom{n+m}{n+1} & \binom{n+m}{n+2} & \cdots & \binom{n+m}{n+k-1}\\
\binom{n+m}{n-1} & \binom{n+m}{n} & \binom{n+m}{n+1} & \cdots & \binom{n+m}{n+k-2}\\
\vdots & \vdots & \vdots & \cdots & \vdots\\
\binom{n+m}{n-k+2} & \binom{n+m}{n-k+3} & \binom{n+m}{n-k+4} & \cdots & \binom{n+m}{n-1}\\
\binom{n+m}{n-k+1} & \binom{n+m}{n-k+2} & \binom{n+m}{n-k+3} & \cdots & \binom{n+m}{n}
\end{vmatrix}
\]

这个矩阵是对一般的正整数$m,n,k$,输入时不能输入完整的矩阵。请教在Mathematica里要怎么输入这种矩阵,来求它的行列式,或者让它参与一些运算,比如矩阵乘法、求逆之类的。

3159

Threads

7932

Posts

48

Reputation

Show all posts

hbghlyj posted 2025-6-22 07:26
对于较大的 k 值,符号 m,n 计算可能非常慢,因此提供了数值版本
  1. (* Define the matrix with binomial coefficients *)
  2. (* The matrix is k×k where each element (i,j) is Binomial[n+m, n+1-i+j-1] *)
  3. BinomialMatrix[n_, m_, k_] := Table[
  4.   Binomial[n + m, n - i + j],
  5.   {i, k}, {j, k}
  6. ]
  7. (* Calculate the determinant *)
  8. BinomialDeterminant[n_, m_, k_] := Det[BinomialMatrix[n, m, k]]
  9. (* Example usage with specific values *)
  10. (* For a 3×3 matrix with n=2, m=3, k=3 *)
  11. exampleMatrix = BinomialMatrix[2, 3, 3]
  12. exampleDet = BinomialDeterminant[2, 3, 3]
  13. Print["Example 3×3 matrix:"]
  14. Print[exampleMatrix // MatrixForm]
  15. Print["Determinant: ", exampleDet]
  16. (* General symbolic computation (for small k) *)
  17. (* Note: For large k, this may take a long time to compute symbolically *)
  18. GeneralDeterminant[k_] := Det[Table[
  19.   Binomial[n + m, n - i + j],
  20.   {i, k}, {j, k}
  21. ]]
  22. (* For numerical evaluation with specific parameters *)
  23. NumericalDeterminant[nVal_, mVal_, kVal_] :=
  24.   Det[Table[Binomial[nVal + mVal, nVal + 1 - i + j - 1], {i, 1, kVal}, {j, 1, kVal}]]
  25. (* Test with some small values *)
  26. Print["Determinant for k=2: ", GeneralDeterminant[2]]
  27. Print["Determinant for k=3: ", GeneralDeterminant[3]]
  28. (* For larger matrices, use numerical values *)
  29. Print["Numerical example (n=5, m=4, k=5): ",
  30.       NumericalDeterminant[5, 4, 5]]
Copy the Code

414

Threads

1638

Posts

14

Reputation

Show all posts

original poster abababa posted 2025-6-22 11:56
hbghlyj 发表于 2025-6-22 07:26
对于较大的 k 值,符号 m,n 计算可能非常慢,因此提供了数值版本
你这个只是算了一些具体的数值,主楼的问题是对一般的m,n,k如何计算,也就是说计算结果一般地应该是含有m,n,k的表达式。

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-6-22 18:27 GMT+8

Powered by Discuz!

Processed in 0.020331 seconds, 22 queries