Tag Info

New answers tagged

2

I'll illustrate on a smallish matrix, using exact arithmetic. That should make it relatively easy to verify correctness. First we create a tridiagonal 5x5 matrix. n = 5; SeedRandom[33333]; mat = RandomInteger[{-100, 100}, {n, n}]; Do[mat[[i, j]] = 0; mat[[j, i]] = 0, {i, 3, n}, {j, 1, i - 2}]; mat (*Out[68]= {{-30, -98, 0, 0, 0}, {12, 72, 29, 0, 0}, {0, ...


1

Although the documentation could be clearer on this point, Eigenvectors doesn't like to work symbolically on a matrix containing elements with approximate numbers. The solution is to Rationalize the matrix. data = {{1.8741*10^7 + 1.40161*10^6 B, 2.79374*10^7}, {2.79374*10^7, -3.1235*10^7 - 1.40161*10^6 B}}; Eigenvectors[Rationalize[data]] // Column ...


3

Thread is the inappropriate tool here as it does not hold its arguments, i.e. it does not have the attribute HoldAll: Attributes@Thread (* {Protected} *) So, ConjugateTranspose[v].H.v evaluates before Thread can operate on it. Also, Thread will attempt to thread across H, as well, which is clearly not what you want. The correct tool to use here is Map: ...


2

Finally I got a feedback from Wolfram support on the AMD algorithm. It turned out that there is (almost as usual) an undocumented implementation of the AMD algorithm within Mathematica. The algorithm is exactly identical to the MATLAB implementation, thus exactly what I was looking for. By calling SparseArray`ApproximateMinimumDegree[m_Matrix] one gets ...


3

Eigenvectors for inexact arguments are normalized: Eigenvectors[{{1, 4}, {4, 100}}] % // N Normalize /@ %% // N Eigenvectors[{{1.0, 4.0}, {4.0, 100.0}}] (* {{1/8 (-99+Sqrt[9865]),1},{1/8 (-99-Sqrt[9865]),1}} {{0.0403383,1.},{-24.7903,1.}} {{0.0403055,0.999187},{-0.999187,0.0403055}} {{0.0403055,0.999187},{-0.999187,0.0403055}} *)


3

Eigenvectors are just a direction, so the ones you have are equivalent up to a multiplicative factor. Both answers are correct. The second one is normalized to length 1.



Top 50 recent answers are included