I am writing, for didactic purposes, a function which performs
factorization of a square-free polynomial using Berlekamp's algorithm.
As for now, I wrote something like
ber: UP(x,INT) -> List(UP(x,INT))
ber(pol) ==
car := 5
GF ==> PF 5
f : UP(x,GF) := pol
.....
and it works: the function compiles correctly and I get the list of all
irreducible factor of the input polynomials of the input.
Clearly, this works only in the prime field GF(5): if I want to use it
in another prime field, I have to change the "5" in the definition of
the function.
In order to have the prime field also in input I tried something like
ber: (NNI,UP(x,INT)) -> List(UP(x,INT))
ber(p,pol) ==
car := p
GF ==> PF p
f : UP(x,GF) := pol
...
Putting aside sanity checks on the primality of p, it works but the
function does not compile, it is just interpreted:
(5) -> ber(7,x^6+1)
Local variable or parameter used in type
We will attempt to interpret the code.
....
This makes me guess that I have been somewhat naif: what is wrong? How
can I correct my function?
Thanks
Fabio
_______________________________________________
Axiom-math mailing list
Axiom-math@nongnu.org
https://lists.nongnu.org/mailman/listinfo/axiom-math