I use Mathematica version 9.0.1.
matA = DiagonalMatrix[ConstantArray[1, 3]];
matB = Normal[SparseArray[{Band[{1, 1}] -> 200, Band[{1, 2}] -> -100,
Band[{2, 1}] -> -100}, {3, 3}]];
{matA, matB}
gives
{{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{200, -100, 0}, {-100, 200, -100}, {0, -100, 200}}}
e1 = Eigenvalues[{matB, matA}]
gives an error:
Eigenvalues::exnum: Eigenvalues has received a matrix with non-numerical or exact elements. >>
e2 = Eigenvalues[N@{matB, matA}]
gives the answer:
{341.421, 200., 58.5786}
Question: Why would e1
give an error when both matrices are numerical? I don't understand why N@{matB, matA}
is needed to get their eigenvalues.
N
you tell it you deliberately add the imprecision, making the decision for it. $\endgroup$ – rcollyer Feb 9 '14 at 20:45