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? Many thanks, Martin I'm not sure whether it helps, but here is how I'd do it in FriCAS: n := 4; SM ==> SquareMatrix(n, FRAC POLY INT) -- create a generic matrix M: SM := matrix [[a[i,j] for j in 1..n] for i in 1..n] -- Computes determinant (M - x*Id) where M is the previous generic matrix. P := determinant (M - x * 1) -- Now evaluate P(M). We find the (0)_4 matrix. Note that you can coerce only -- to a univariate polynomial (short: UP), since matrix multiplication is not -- commutative... (P::UP(x, SM)) M --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---