Martin Rubey wrote:
> Jason Grout <[EMAIL PROTECTED]> writes:
> 
>> Martin Rubey wrote:
>>> I tried to demonstrate Cayley Hamilton in Sage, but failed.  Here is what I
>>> tries:
>>>
>>> sage: f = function('f')
>>> sage: m = matrix([[f(i,j) for j in range(2)] for i in range(2)])
>>> sage: p=SR[x](m.characteristic_polynomial('x'))
>>> sage: p.subs(x=m)
>>>
>>> [(f(0, 0) - x)*(f(1, 1) - x) - f(0, 1)*f(1, 0)
>>> 0]
>>> [                                            0 (f(0, 0) - x)*(f(1, 1) - x) -
>>> f(0, 1)*f(1, 0)]
>>>
>>> Of course, the result *should* be the zero matrix.  It seems that the value 
>>> of
>>> p is not what I'd expect:
>>>
>>> sage: p.coefficients()
>>> [(f(0, 0) - x)*(f(1, 1) - x) - f(0, 1)*f(1, 0)]
>>>
>>> So, probably the question is: how do I create a polynomial over Symbolic 
>>> Ring
>>> properly?
>> To answer your original question:
>>
>>
>>
>> sage: f = function('f')
>> sage: m = matrix([[f(i,j) for j in range(2)] for i in range(2)])
>> sage: p=m.charpoly('x')
>> sage: p
>> (f(0, 0) - x)*(f(1, 1) - x) - f(0, 1)*f(1, 0)
>> sage: p.coefficients(x)
>> [[f(0, 0)*f(1, 1) - f(0, 1)*f(1, 0), 0], [-f(1, 1) - f(0, 0), 1], [1, 2]]
>>
>> However, we run into problems.  Any comments on these, anyone?
> 
> Why is your coefficients different from mine?


I specifically asked for the coefficient of "x".  You just asked for the 
coefficients, but didn't specify what variable was the variable of your 
polynomial.

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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to