axiom-math
[Top][All Lists]
Advanced

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

Re: [Axiom-math] Writing packages


From: Ralf Hemmecke
Subject: Re: [Axiom-math] Writing packages
Date: Sat, 13 May 2006 23:58:32 +0200
User-agent: Thunderbird 1.5.0.2 (X11/20060420)

On 05/13/2006 10:35 PM, Fabio S. wrote:
BTW, I also have another question on this topic: if I compute the characteristic polynomial of a matrix and then I evaluate the polynomial at the matrix, I would expect to have the zero matrix as result. This does not happens: try

 m:=matrix([[1,2],[3,4]])
 p:=characteristicPolynomial(m)
 p(m)

 Why?

Because Axiom is not smart enough to figure out all the types for you.

Does this make you happier?

M := SquareMatrix(2,Integer)
m:M:=matrix([[1,2],[3,4]])
P:=SUP(M)
p: P := characteristicPolynomial(m)::P
x := first variables p
eval(p, x, m)

I must say that this doesn't make me happier at all. I didn't expect that evaluating a polynomial at a matrix was such a terrible task for the type resolver in axiom: the result of characteristicPolynomial(m) is a polynomial with integer coefficient in one variable. I can't see the difficulty to convert it to UP SquareMatrix(2,Integer) (of course, just from a mathematical point of view).

Well, as I said SUP(Integer) should have been enough. But now, what you actually want is NOT a polynomial. You want a *function*

charpol: SquareMatrix(2, Integer) -> SquareMatrix(2, Integer)

and that is something different. I am sure you know the difference.

The big trouble now is to convert the polynomial you get into a polynomial function with the above type. I guess the interpreter would have been able to find such a conversion if there were an implementation of an evaluation of a polynomial at a *square* matrix (arbitrary matrices would, of course, not work). However, my browsing through hyperdoc was unsuccessful. So I guess the non-existence of such an implementation makes the interpreter telling you about the problem.

Moreover, given the Hamilton-Cayley, it doesn't seem to me a very bizzarre idea to try to evaluate the char pol of a matrix at the matrix itself...

No, of course, not. But as far as I can tell, that is not directly implemented.

I would expect that this is the first example for every linear algebra student, so I would expect that the implementation of the function should take care of this possibility.

I somehow have the impression that is one of the reasons why Axiom failed commercially. Simple things must be expressed in a complicated manner. I agree that Axiom is not (yet) perfect. Just help and provide a implementation for such a function and make all the people who come after you happier.

Thank you

Ralf




reply via email to

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