On Sun, Mar 28, 2010 at 12:35 PM, Owen <[email protected]> wrote: > I'd like to have the result of a sage calculation somehow remain as an > irrational fraction. Specifically, here I'm calculating the > eigenvalues of the matrix who's powers generate the fibonacci numbers: > sage: m=matrix(2,2,[0,1,1,1]);m > [0 1] > [1 1] > sage: m.eigenvalues () > [-0.618033988749895?, 1.618033988749895?] > > I'd LOVE to be able to somehow get the more meaningful value of which > contains the 1+/-sqrt(5) form:
Just use SR = SymbolicRing(): sage: m=matrix(SR,2,2,[0,1,1,1]);m [0 1] [1 1] sage: m.eigenvalues() [-1/2*sqrt(5) + 1/2, 1/2*sqrt(5) + 1/2] > > sage: n=(1+sqrt(5))/2;n > 1/2*sqrt(5) + 1/2 > sage: N(n) > 1.61803398874989 > > Is there some way I can ask for the eigenvalues (or any other roots) > in such a format? > > [This is pretty noob, I realize, but I tried several searches, and > even found golden-ratio, but couldn't figure out how to achieve the > desired result of not evaluating irrationals] > > Thanks! Sage rocks! +100 > > -- Owen > > -- > 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 > > To unsubscribe from this group, send email to > sage-support+unsubscribegooglegroups.com or reply to this email with the > words "REMOVE ME" as the subject. > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org -- 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 To unsubscribe from this group, send email to sage-support+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
