Hi Laurent,

On 1 Mai, 16:33, Laurent <[email protected]> wrote:
> Or, alternatively, how do I get the radical form of a in the following ?
> sage: sageMatrix = matrix(QQ,[[1,4],[4,2]])
> sage: eig=sageMatrix.eigenvalues()
> sage: eig[0]
> sage: a=eig[0]

Kind of a solution is provided by the method as_number_field_element:

 sage: M = matrix(QQ,[[1,4],[4,2]])
 sage: ev1,ev2 = M.eigenvalues()
 sage: ev1.as_number_field_element()
 (Number Field in a with defining polynomial y^2 - y - 16, -a + 2,
Ring morphism:
   From: Number Field in a with defining polynomial y^2 - y - 16
   To:   Algebraic Real Field
   Defn: a |--> 4.531128874149275?)

So, ev1 (and ev2 as well) are obtained from minus the roots of x^2-
x-16 plus two.
And the polynomial can be solved for:
 sage: solve(x^2-x-16,x)
 [x == -1/2*sqrt(65) + 1/2, x == 1/2*sqrt(65) + 1/2]

Confirming the result:

 sage: RR(-(-1/2*sqrt(65) + 1/2)+2) == RR(ev2)
 True
 sage: RR(-(1/2*sqrt(65) + 1/2)+2) == RR(ev1)
 True

Certainly the above can somehow be automated.

Cheers,
Simon

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