Re: Writing packages
Ralf Hemmecke <[email protected]>
| Newsgroups | gmane.comp.mathematics.axiom.general |
|---|---|
| Message-ID | <[email protected]> |
> 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) There is no function apply: (P, M) -> M. So how have to browse through hyperdoc a bit. And not that the P given above is much more appropriate than Polynomial Integer. Actually, SUP(Integer) should do, but then there is no way to evaluate such a polynomial at a matrix. Ralf