# Matlab - eigenvalue doesn't zero the characteristic polynomial

I created a symmetric $21 \times 21$ matrix $A$ with condition number $7.5044$. I wrote the following code:

syms x;
AS = sym(A);
polyA = charpoly(AS,x);
solve(polyA);


and this is the result

  93.988842796147505104718718233034
63.318989852350135397493503048259
38.392863684000190231816927188875
57.023973670819117411135094232301
20.964197497113106525263127789941
52.100859003607712279511955297751
14.457776205660758291480361189262
72.543368263184623095490492872815
-19.500133944896490949432003697463
65.733078713316290701540791543043
71.723898977718034735792925663278
57.262150118578505531059649955477
27.620774843148443240592651344762
49.356126883789838887152595264487
51.847578071455088288616446818711
70.832873937409296415793129090208
12.524474726415933018910355256388
37.721878707889458815773572522044
-39.123034260347914003761194641743
82.618237465274092122200710770248
12.591224787366274858850190258322


I expect the following code to be close to zero

double(subs(polyA,37.721878707889458815773572522044))


But the answer of the matlab is -2.2191e+11, other eigenvalues generate other big numbers as well. Why the eigenvalues don't zero the polyA while the condition number is just $\approx 7$?

• If you pick a larger symmetric matrices you can observe complex eigenvalues found by MATLAB. :-) – dEmigOd Aug 14 '18 at 10:00
• @dEmigOd really?! Well it is the limits of the computations. May be we need to switch to quantum computing in the future ;) – M a m a D Aug 14 '18 at 16:44
• How did you create matrix A? It would be useful to know, so one can use, say, SymPy instead. – Rodrigo de Azevedo Aug 15 '18 at 6:56