Dear Simon,
 Thanks a lot.

With regards,
Santanu

On 25 August 2011 23:02, Simon King <simon.k...@uni-jena.de> wrote:

> Hi Santanu!
>
> On 25 Aug., 18:03, Santanu Sarkar <sarkar.santanu....@gmail.com>
> wrote:
> > How to calculate inverse of a polynomial f(x) modulo g(x) in the finite
> > field GF(2^10)?
>
> The usual way to compute modular inverses in a polynomial ring over a
> field is the extended Euclidean algorithm, xgcd.
>
> We start with a polynomial ring over GF(2^10):
>   sage: P.<x> = GF(2^10,'z')[]
>
> Next, we get two random polynomials. They happen to be relatively
> prime, hence, there *is* an inverse of the first polynomial modulo the
> second polynomial:
>   sage: p = P.random_element()
>   sage: q = P.random_element()
>   sage: gcd(p,q)
>   1
>
> Now, xgcd is a method of q, and I suggest that you read its
> documentation.
>
>   sage: d, _, pinv = q.xgcd(p)
>   sage: d  # test again that the gcd is one
>   1
>
> Now, we verify that pinv really is the inverse of p modulo q:
>
>   sage: q.divides(1-p*pinv)
>   True
>
> Best regards,
> Simon
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to