Martin Rubey wrote:
> Jason Grout <[EMAIL PROTECTED]> writes:
>
>>> 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.
>
> OK, I think I understand now: Sage interprets the x as element of
> SymbolicRing,
> since it does the coercion afterwards...
>
> Being used to FriCAS, I thought that characteristic_polynomial('x') would
> return a polynomial in x with coefficients from Symbolic Ring. It doesn't
> really, since it coerces the x into an element of SymbolicRing.
>
> Oh dear.
Good point. I hadn't thought about it that way before. Yes, that is
what seems to be happening:
sage: f = function('f')
sage: m = matrix([[f(i,j) for j in range(2)] for i in range(2)])
sage: R.<x> = SR[]
sage: type(x)
<type 'sage.rings.polynomial.polynomial_element.Polynomial_generic_dense'>
sage: g=m.characteristic_polynomial(x)
sage: g
(f(0, 0) - x)*(f(1, 1) - x) - f(0, 1)*f(1, 0)
sage: type(g)
<class 'sage.calculus.calculus.SymbolicArithmetic'>
I think SR is somewhat viral in this regard. Anything that has to do
with SR gets converted to SR, with the current implementation. I think
the symbolics rewrite will make this a lot better, though.
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
-~----------~----~----~----~------~----~------~--~---