Kevin Acres on Thu, 01 Feb 2024 05:59:06 +0100


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

Rational exponent


I have a function that I would like to use with rational exponents. Currently it only works with integral exponents.

I'm struggling a little and any help is welcomed.

Kevin.

/*
 * z : Integer input 0..2^n-1
 * p : irreducible polynomial of degree n
 * n : output is in binary format 0..2^n-1
 * e : exponent
*/
fn2(z,p,n,e) = {
    my(s,t=vector(n)~,k,a);

    if(z==0, return(t~););
    k = Pol(binary(z))^e;
    a = lift(Mod(k, p));
    s=Vecrev(a);
    s *= denominator(s);
    s %= 2;
    for(i=1,#s,
        t[i]=s[i];
    );
    t~;
};