Ask Your Question
1

Polynomial division mod n

asked 2013-06-02 21:37:25 +0200

cp_sage gravatar image

updated 2013-06-02 22:25:51 +0200

Hi everyone,

Let's suppose that we are working with polynomials modulo n a composite number, for which we know the factorization (n=p*q). If we know that f(x) can be divided by e.g. g(x), what is the most efficient way to calculate f(x)/g(x) in Z_n with Sage?

Thanks for your time

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-06-03 04:28:44 +0200

vdelecroix gravatar image

I do not know if this is the best answer but it works

sage: K = Zmod(543)    # the ring Z/nZ
sage: R.<x> = PolynomialRing(K,'x')
sage: f = 3*x^5 + 2*x + 1
sage: g = 2*x + 1
sage: f.quo_rem(g)
(273*x^4 + 135*x^3 + 204*x^2 + 441*x + 52, 492)

The method quo_rem returns the 2-tuple made of the quotient and the remainder of the division.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-06-02 21:37:25 +0200

Seen: 1,955 times

Last updated: Jun 03 '13