axiom-math
[Top][All Lists]
Advanced

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

[Axiom-math] Function having a field as input


From: Fabio Stumbo
Subject: [Axiom-math] Function having a field as input
Date: Wed, 20 Jun 2018 18:59:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

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









reply via email to

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