On 11/3/10 3:30 PM, David Joyner wrote:
Hi:

Sage seems to be reporting eigenvalues incorrectly. Can this bug been
reported before?


It's well known that serious numerical issues come up when doing eigenvalues of CC or RR matrices. That's why the warning is printed that you see below.

Try using CDF, which ends up using numpy:

sage: M = matrix(CDF,[ [ 1476226, 1476226, 1476224, 1476225, 1476224 ],
    [ 1476226, 1476224, 1476225, 1476224, 1476226 ],
    [ 1476224, 1476225, 1476224, 1476226, 1476226 ],
    [ 1476225, 1476224, 1476226, 1476226, 1476224 ],
    [ 1476224, 1476226, 1476226, 1476224, 1476225 ] ])
sage: M.eigenvalues()
[7381125.0, 2.23606797746 - 4.42419210147e-31*I, 2.23606797737 + 4.42417798985e-31*I, -2.23606797751 + 1.92201810023e-11*I, -2.23606797751 - 1.92199318576e-11*I]

Sometime, we'll hopefully have an ALGLIB interface that will fix this for CC.

Maybe we should add a note to the warning printed out below to try using CDF instead of CC, and RDF instead of RR.

Jason



sage: M = matrix(QQ,[ [ 1476226, 1476226, 1476224, 1476225, 1476224 ],
....:     [ 1476226, 1476224, 1476225, 1476224, 1476226 ],
....:     [ 1476224, 1476225, 1476224, 1476226, 1476226 ],
....:     [ 1476225, 1476224, 1476226, 1476226, 1476224 ],
....:     [ 1476224, 1476226, 1476226, 1476224, 1476225 ] ])
sage: M.eigenvalues()
[7381125, -2.236067977499790?, 2.236067977499790?,
-2.236067977499790?, 2.236067977499790?]
sage: M = matrix(CC,[ [ 1476226, 1476226, 1476224, 1476225, 1476224 ],
     [ 1476226, 1476224, 1476225, 1476224, 1476226 ],
     [ 1476224, 1476225, 1476224, 1476226, 1476226 ],
     [ 1476225, 1476224, 1476226, 1476226, 1476224 ],
     [ 1476224, 1476226, 1476226, 1476224, 1476225 ] ])
sage: M.eigenvalues()
.../sage-4.6/local/bin/sage-ipython:1: UserWarning: Using generic
algorithm for an inexact ring, which will probably give incorrect
results due to numerical precision issues.
   #!/usr/bin/env python
[7.38112500000000e6 - 5.79188112676979e-48*I, 373.809799796897 +
373.812578248468*I, 373.809799796897 - 373.812578248468*I,
-373.809799797006 + 373.793647358285*I, -373.809799797006 -
373.793647358285*I]

- David Joyner



--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to