On 11/15/11 10:09 AM, David Joyner wrote:
On Tue, Nov 15, 2011 at 10:59 AM, samuel<[email protected]> wrote:Hi,I have the following matrix and want to determine the eigenvalues of it. M3=matrix(RR,[ [0, 0.095, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.905], [0.255, 0, 0.745, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0.255, 0, 0.745, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0.905, 0, 0.095, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0.255, 0, 0.745, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0.255, 0, 0.745, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0.905, 0, 0.095, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0.255, 0, 0.745, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0.255, 0, 0.745, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0.905, 0, 0.095, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0.255, 0, 0.745], [0.745, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.255,0]]) M3.eigenvalues() I got the following message: NotImplementedError: eigenvalues() is not implemented for matrices with eigenvalues that are not in the fraction field of the base ring or in QQbar I have no idea what the message mean as I don't have enough math backgrounds to make sense of it. I tried to do the same thing on Mathematica and I got several complex eigenvalues. I wonder if sage does not support determining complex eigenvalues.I think you want this:
Or this: http://sagenb.org/home/pub/3678/I think the point here is that by default, the characteristic polynomial of a matrix over RR is a polynomial over RR, and it tries to find roots in RR. Of course, these eigenvalues don't all lie in RR, so you get the complaint.
I'd also highly suggest that you use either RDF as the field (which uses stable numerical algorithms for finding eigenvalues), or use QQ as the field (which converts to exact rational numbers, then finds the eigenvalues exactly).
I also think it's embarrassing to Sage that if you don't specify the field (i.e., just do matrix([...]) with the above matrix), then it automatically constructs a matrix over RR and then complains that it can't find the eigenvalues. It really does look like Sage can't find the eigenvalues of a simple numeric matrix. Maybe a RR matrix (53-bit precision) should use the scipy routines (like RDF does) to find the eigenvalues, at least until a possible alglib interface or something of that nature is finished.
Thanks, Jason -- 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
