/usr/share/axiom-20170501/src/algebra/CHARPOL.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | )abbrev package CHARPOL CharacteristicPolynomialPackage
++ Author: Barry Trager
++ Description:
++ This package provides a characteristicPolynomial function
++ for any matrix over a commutative ring.
CharacteristicPolynomialPackage(R) : SIG == CODE where
R : CommutativeRing
PI ==> PositiveInteger
M ==> Matrix R
SIG ==> with
characteristicPolynomial : (M, R) -> R
++ characteristicPolynomial(m,r) computes the characteristic
++ polynomial of the matrix m evaluated at the point r.
++ In particular, if r is the polynomial 'x, then it returns
++ the characteristic polynomial expressed as a polynomial in 'x.
CODE ==> add
---- characteristic polynomial ----
characteristicPolynomial(A:M,v:R) : R ==
dimA :PI := (nrows A):PI
dimA ^= ncols A => error " The matrix is not square"
B:M:=zero(dimA,dimA)
for i in 1..dimA repeat
for j in 1..dimA repeat B(i,j):=A(i,j)
B(i,i) := B(i,i) - v
determinant B
|