Le jeudi 7 novembre 2013 18:28:31 UTC+1, Nils Bruin a écrit :
>
> On Thursday, November 7, 2013 9:00:36 AM UTC-8, ccandide wrote:
>>
>> I dont' understand why Sage is unable to give an exact expression for the
>> eigenvalues of the following matrix :
>>
>> sage: A= matrix([[0,1],[1,-2]])
>> sage: [a for a,_,_ in A.eigenvectors_right()]
>> [-2.414213562373095?, 0.4142135623730951?]
>>
>
> It does have an exact expression for them. It just prints an approximation
to them. The "?" is a bit of a give-away that there might be more to it
than just plain floats here:
>
> sage: v=[a for a,_,_ in A.eigenvectors_right()][0]
> sage: parent(v)
> Algebraic Field
> sage: v.minpoly()
> x^2 + 2*x - 1
>
OK, I get it!!
> The reason sage decides to use this representation is because printing
> these things in terms of sqrt(2) quickly runs out of steam:
> sage: M=matrix(5,5,[0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,-3,-1,0,0,0 ])
> sage: M.eigenvectors_right()[0][0]
> -1.132997565885066?
> (see what you get in maple for that)
>
Maple gives the following :
A:=Matrix(5,5,[0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,-3,-1,0,0,0 ]);
[ 0 1 0 0 0]
[ ]
[ 0 0 1 0 0]
[ ]
A := [ 0 0 0 1 0]
[ ]
[ 0 0 0 0 1]
[ ]
[-3 -1 0 0 0]
> Eigenvalues(A)[1];
>
5
RootOf(3 + _Z + _Z, index = 1)
I don't how Maple is able to work symbolically with that.
>
> Perhaps with A=matrix(SR,[[0,1],[1,-2]]) you get an answer that looks more
> comfortable to you.
>
Exactly what I was looking for, many thanks.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.