Dear all,

I'm trying to work with polynomials modulo x^N-1 whose coefficients belong 
to Z_p (If it helps p is a power of a prime). I know that I'm doing 
something wrong, but I cannot figure out what so any help is welcome.
p=32
N=100
ZZp.<x> = PolynomialRing(Integers(p))
#find an element that can be inverted
pp=ZZp.random_element()
while True:
    try:
        ppInv=pp.inverse_mod(x^N-1)
        break
    except:
        pp=ZZp.random_element()
#multiply the inverses
print (pp*ppInv).mod(x^N-1)

The result is not always 1 (sometimes it is though). So the question is 
why? From their definition, the two polynomials are inverse but their 
product is not 1? Am I interprenting wrong?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to