Re: Bug or feature in Eigensystem[]?
- To: mathgroup@smc.vnet.net
- Subject: [mg11735] Re: Bug or feature in Eigensystem[]?
- From: Paul Abbott <paul@physics.uwa.edu.au>
- Date: Thu, 26 Mar 1998 03:09:02 -0500
- Organization: University of Western Australia
- References: <6f1ojf$fel@smc.vnet.net>
John Sidles wrote: > Usually, given a real symmetric matrix, Eigensystem[] returns what > anyone would expect: real eigenvectors. But about one time in a > thousand (for my example matrices, see below), it turns out that > Eigensystem[] returns complex eigenvectors. Isn't this problem closely related to the following: In[1]:= N[Expand[Product[x - i, {i, 25}]]]; In[2]:= NSolve[% == 0] Out[2]= {{x -> 1.}, {x -> 2.}, {x -> 3.}, {x -> 4.}, {x -> 5.}, {x -> 6.00001}, {x -> 6.99976}, {x -> 8.00217}, {x -> 8.98954}, {x -> 10.0075}, {x -> 11.1935}, {x -> 11.6495}, {x -> 12.4625}, {x -> 13.7253 - 1.65078 I}, {x -> 13.7253 + 1.65078 I}, {x -> 16.1031 - 2.4638 I}, {x -> 16.1031 + 2.4638 I}, {x -> 18.7034 - 2.57648 I}, {x -> 18.7034 + 2.57648 I}, {x -> 21.1528}, {x -> 21.441 - 2.36683 I}, {x -> 21.441 + 2.36683 I}, {x -> 24.157}, {x -> 24.72}, {x -> 24.72}} Althouth the (exact) roots (eigenvalues) are the integers from 1 to 25, complex roots have arisen. The tiniest perturbation of coefficients easily leads to complex roots. > -- this behavior can really can > really mess up a quantum mechanical calculation. And even if you know > it is present, it is not clear how to fix it. Advice is welcome. One way is to work with arbitrary precision (using SetPrecision) instead of fixed precision. E.g., you can wrap SetPrecision around your calls to Random[]. Another is to work with the exact eigenvalues. For your hMatrix, Mathematica can, in fact, find the exact eigenvalues. And, if you substitute in one of your examples, you will see that, essentially, the problem is not really a problem with Eigenvalue: Out[2]=Eigenvalues[hMatrix] /. { \[Beta] -> 0.0008834275476470427, \[Gamma] -> 0.0005840710403388} Out[2]= -20 {3.00088, 3.00029, 1.00088 - 5.74376 10 I, -16 -16 2.99989 + 1.66533 10 I, 3.00127 - 1.66533 10 I, -20 -20 5.00088 + 5.7404 10 I, 1.00029 - 1.9133 10 I, -17 -17 2.99989 + 5.55111 10 I, 3.00127 - 5.55112 10 I, -20 -19 5.00029 + 1.91441 10 I, 2.00016 + 1.08285 10 I, -19 -19 2.00016 + 1.08285 10 I, 2.00101 - 1.08377 10 I, -19 -20 2.00101 - 1.08377 10 I, 3.99989 + 6.72217 10 I, -20 -20 3.99989 + 6.72217 10 I, 4.00127 - 6.7129 10 I, -20 4.00127 - 6.7129 10 I} Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul@physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________