[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [Axiom-developer] evaluate a polynom for a matrix.

**From**: |
Francois Maltey |

**Subject**: |
[Axiom-developer] evaluate a polynom for a matrix. |

**Date**: |
01 Apr 2007 18:57:44 +0200 |

**User-agent**: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |

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.
Maple fails in the subs command of a*M^2 + b*M + c
because (a*M^2 + b*M) is a matrix, and c is a number.
Mupad could do it.
How can I do it with axiom ?
I have the beginning of the Caley-Hamilton theorem :
Now I must compute P(M) and find the zero matrix for n=1,2,3,4,5.
--
-- Create a generic matrix
--
matriceN1 := n +-> _
matrix [[("a".(i::String).(j::String))::Symbol for j in 1..n] for i in 1..n]
matriceN2 n ==
matrix [[("a".(i::String).(j::String))::Symbol for j in 1..n] for i in 1..n]
M4 := matriceN2 4
--
-- Create an identity matrix
--
(matrice N1 4)^0
zeroOrOne := b +-> if b then 1 else 0
matriceId1 := n +-> _
matrix [[zeroOrOne ((i=j)::Boolean) for j in 1..n] for i in 1..n]
matriceId1 4
matriceId2 := n +-> diagonalMatrix [1 for k in 1..n]
matriceId2 5
coeff := (i, j) +-> if i=j then 1 else 0
matriceId3 := n +-> matrix [[coeff (i,j) for i in 1..n] for j in 1..n]
matriceId3 4
--
-- Computes determinant (M - x*Id) where M is the previous generic matrix
--
polCar := M +-> determinant (M - x * matriceId2 ncols M)
polCarN := n +-> polCar matriceN1 n
polCarN 2
P4 := polCarN 4
--
-- Now evaluate P4(M4). We might find the (0)_4 matrix.
--

**[Axiom-developer] evaluate a polynom for a matrix.**,
*Francois Maltey* **<=**