Please direct questions of this kind to [EMAIL PROTECTED] Francois Maltey <[EMAIL PROTECTED]> writes:
> Hello, > > Let P in Ring[X] and M in SquareMatrix(Ring) > > The mathematics evaluate P(M) > by sum (ak*M^k, k=0..deg P) in SquareMatrix(Ring) > where P = sum (ak*X^k, k=0..deg P) > > How can I do this in axiom. -- work in SquareMatrix(n, FRAC POLY INT) 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] -- Create an identity matrix I: SM := 1; -- Computes determinant (M - x*Id) where M is the previous generic matrix. -- note that characteristicPolynomial would do this for youm however, for some -- strange reason, it accepts an element of Matrix R instead of SquareMatrix R. P := determinant (M - x * I) -- Now evaluate P(M). We find the (0)_4 matrix. Note that you can coerce only -- to a univariate polynomial, since matrix multiplication is not -- commutative... (P::UP(x, SM))(M) _______________________________________________ Axiom-math mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/axiom-math
