On Sat, Apr 4, 2015 at 8:29 PM, absinthe <kpat...@gmail.com> wrote:
> 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?
>

Maybe you want a polynomial f(x) in GF(p)[x] with the property that
f(x) has an inverse in GF(p)[x]/(x^N - 1)? An f(x) in GF(p)[x] has this property
if an only if gcd(f(x), x^N - 1) = 1. Moreover, you can find the
inverse of f(x) in this
ring using xgcd. All this is implemented in Sage.


> 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 sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
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