Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
3  
The phrase is "non-numerical or exact". Since the elements do not have decimal places, Mathematica is loathe to introduce imprecision which is required by the algorithm, hence the message. So, by using N you tell it you deliberately add the imprecision, making the decision for it. –  rcollyer Feb 9 at 20:45
    
@rcollyer You should probably make that an answer. It is the answer. –  Szabolcs Feb 9 at 20:50
    
@user11946 Can you please choose a display name? The generic "user11946" is hard to remember ... –  Szabolcs Feb 9 at 20:51
    
@rcollyer - It is subtle but I can see it now. Thanks for the insight. –  user11946 Feb 9 at 21:12
1  
@user11946. No one is asking you to display your real name. Just change your username to something memorable. –  RunnyKine Feb 9 at 22:01
show 1 more comment

1 Answer 1

This is rcollyer's comment posted as an answer because as Szabolcs says, it is the answer.

The phrase is "non-numerical or exact". Since the elements do not have decimal places, Mathematica is loathe to introduce imprecision which is required by the algorithm, hence the message. So, by using N you tell it to deliberately add the imprecision, making the decision for it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.