"letsimp" honors "modulus" only partially?



Hi,

Stavros Macrakis wrote:

> But if you want to do the original calculation faster, you can code up
> the reduction (iterative ratsubst) very simply yourself:
> 
>     iratsubst(a,b,c,modulus):=
>         (a:rat(a),b:rat(b),c:rat(c),
>          while(c # (c:ratsubst(a,b,c))) do 1,
>          c);

I see. That's really simple! Exponentiation in GF(5^3) is instantaneous
with it.

> Unfortunately, it runs into some limitations with ratsubst:
> 
>    ratsubst(x+2,x^3,x^3030),modulus:1009;
>    Maxima encountered a Lisp error:
>    Error in PROGN [or a callee]: Bind stack overflow.

Same here.

Anyway, specialising on exponentiation, it should be possible to
implement bottom-up square-and-multiply, reducing (using either
ratsubst or letsimp) after each step. This way the inputs to these
functions are always so small that they won't run into any restriction.

But gf already does something to this effect and my intent at present
is to avoid additional programming and use what's already available.

Thanks again,

Lutz