Re: [Axiom-developer] evaluate a polynom for a matrix.
Martin Rubey <[email protected]>
| Newsgroups | gmane.comp.mathematics.axiom.general,gmane.comp.mathematics.axiom.devel |
|---|---|
| Message-ID | <[email protected]> |
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)