adh*_*lon 5 wolfram-mathematica eigenvalue eigenvector
基本上我试图找到矩阵的特征值,大约需要12个小时.当它完成时,它说它找不到所有的特征向量(实际上几乎没有),而且我对它找到的那些特征向量持怀疑态度.我所能做的就是发布我的代码,我希望有人可以向我提出一些建议.我对mathematica不太熟悉,也许运行时间慢,结果不好与我有关,而不是mathematica的能力.感谢任何回复的人,我真的很感激.
cutoff = 500; (* set a cutoff for the infinite series *)
numStates = cutoff + 1; (* set the number of excited states to be printed *)
If[numStates > 10, numStates = 10];
$RecursionLimit = cutoff + 256; (* Increase the recursion limit to allow for the specified cutoff *)
(* set the mass of the constituent quarks *)
m1 := mS; (* just supposed to be a constant *)
m2 := 0;
(* construct the hamiltonian *)
h0[n_,m_] := 4 Min[n,m] * ((-1)^(n+m) * m1^2 + m2^2);
v[0,m_] := 0;
v[n_,0] := 0;
v[n_,1] := (8/n) * ((1 + (-1)^(n + 1)) / 2);
v[n_,m_] := v[n - 1, m - 1] * (m/(m - 1)) + (8 m/(n + m - 1))*((1 + (-1)^(n + m))/2);
h[n_,m_] := h0[n,m] + v[n,m];
(* construct the matrix from the hamiltonian *)
mat = Table[h[n,m], {n, 0, cutoff}, {m, 0, cutoff}] // FullSimplify;
(* find the eigenvalues and eigenvectors, then reverse the order *)
PrintTemporary["Finding the eigenvalues"];
{vals, vecs} = Eigensystem[N[mat]] // FullSimplify;
$RecursionLimit = 256; (* Put the recursion limit back to the default *)
Run Code Online (Sandbox Code Playgroud)
我的代码还有一些,但这是真正放慢速度的重点.我必须提到的一点是,如果我将m1和m2都设置为零,我真的没有任何问题,但将m1设置为常量会让一切都变得地狱.
你的问题是常数mS仍然是象征性的.这意味着Mathematica试图分析求解特征值而不是数值.如果您的问题允许您选择数值,则mS应该这样做.
您遇到的另一个无关的问题是您正在使用递归公式,并且您希望在以下行中使用例如memoization
v[n_, m_] := v[n, m] = v[n - 1, m - 1]*(m/(m - 1))
+ (8 m/(n + m - 1))*((1 + (-1)^(n + m))/2);
Run Code Online (Sandbox Code Playgroud)
额外v[n, m] =存储给定的值n,m因此您不必一直递归到v[0,0]每次h[n, m]调用Table[].
有了这两件事,我的旧核心2 duo需要不到一分钟的时间来完成特征值.
| 归档时间: |
|
| 查看次数: |
2627 次 |
| 最近记录: |