[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-math] Re: [Axiom-developer] evaluate a polynom for a matrix.

From: Martin Rubey
Subject: [Axiom-math] Re: [Axiom-developer] evaluate a polynom for a matrix.
Date: 01 Apr 2007 20:39:19 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Please direct questions of this kind to address@hidden

Francois Maltey <address@hidden> 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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]