On 03/28/2010 02:50 PM, Mike Hansen wrote:
On Sun, Mar 28, 2010 at 12:35 PM, Owen<[email protected]>  wrote:
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?

You can see that

sage: ((1+sqrt(5))/2).parent()
Symbolic Ring

So, if you make your matrix over the Symbolic Ring (SR), then you get:

sage: 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]

There should be some way to get if from [-0.618033988749895?,
1.618033988749895?] which really store exact values, but I'm not sure
off the top of my head.


sage: QQbar(-1/2*sqrt(5) + 1/2)
-0.618033988749895?
sage: a=QQbar(-1/2*sqrt(5) + 1/2)
sage: a
-0.618033988749895?
sage: a.minpoly()
x^2 - x - 1
sage: solve(SR(a.minpoly()),x)
[x == -1/2*sqrt(5) + 1/2, x == 1/2*sqrt(5) + 1/2]

On the other hand, I think it would fairly straightforward for QQbar objects to print out quadratic roots (that it knows are quadratic roots) in the above format (using the quadratic equation), instead of using the interval notation. It'd probably one or two if-cases in the printing code.

Thanks,

Jason




--Mike



--
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.

Reply via email to