基本上我试图找到矩阵的特征值,大约需要12个小时。当它结束时,它说它找不到所有的特征向量(实际上几乎没有),我对它找到的那些特征向量持怀疑态度。我所能做的只是发布我的代码,我希望有人能够向我提出一些建议。我对mathematica并不是很有经验,也许运行时间很慢,不好的结果与我有关,而不是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 *)
还有一点我的代码,但这是真正放缓的点。我应该提到的一件事是,如果我将m1和m2设置为零,我没有任何问题,但将m1设置为常数会使所有事情都陷入困境。
它可能是值得指出的是时间的显著块都花在构建矩阵了(即使有记忆化作为蒂莫建议)。'RSolve'为'v'的递归定义提供了一个明确的形式,虽然修改未确定的函数(通过初始条件)可能会因分支切割等原因而变得复杂。在任何情况下,如果您进一步扩展它,这可能是看着。 – acl