Finite field polynomial ring quotient and reminder

48 views
Skip to first unread message

srgbl...@gmail.com

unread,
Jul 25, 2016, 6:24:56 AM7/25/16
to sage-support
Hello,

I'm stalled try to calculate a division in a polynomial ring defined over a field that is a finite field.

sage: _.<z> = GF(2)[]
sage: K.<z> = GF(2^8, modulus=z^8+z^4+z^3+z+1)
sage: R = PolynomialRing(K,'x')
sage: l = x^4 + 1
sage: c = (z+1)*x^3+x^2+x+(z)
sage: l/c
(x^4 + 1)/((z + 1)*x^3 + x^2 + x + z)

But I like to find the quotient and the reminder of this division. How should I write it?

I've tried in all the ways I've thought and searched for similar questions, but looks like using a finite field to define the ring may need something specific.

Thanks

/Sergi.

Dima Pasechnik

unread,
Jul 25, 2016, 6:38:29 AM7/25/16
to sage-support


On Monday, July 25, 2016 at 11:24:56 AM UTC+1, srgbl...@gmail.com wrote:
Hello,

I'm stalled try to calculate a division in a polynomial ring defined over a field that is a finite field.

sage: _.<z> = GF(2)[]
sage: K.<z> = GF(2^8, modulus=z^8+z^4+z^3+z+1)

this looks fishy, to re-use z this way. See below.
 
sage: R = PolynomialRing(K,'x')
sage: l = x^4 + 1
sage: c = (z+1)*x^3+x^2+x+(z)
sage: l/c
(x^4 + 1)/((z + 1)*x^3 + x^2 + x + z)

But I like to find the quotient and the reminder of this division. How should I write it?

sage: _.<z0>=GF(2)[]
sage: K.<z> = GF(2^8, modulus=z0^8+z0^4+z0^3+z0+1)
sage: R.<x>=K[]
sage: l = x^4 + 1
sage: c = (z+1)*x^3+x^2+x+(z)
sage: l.quo_rem(c)
((z^7 + z^6 + z^5 + z^4 + z^2 + z)*x + z^6 + z^4 + z,
 (z^7 + z^5 + z^2)*x^2 + (z^7 + z^5 + z^2 + 1)*x + z^7 + z^5 + z^2 + 1)
sage: qo,re=l.quo_rem(c)
sage: qo*c+re
x^4 + 1


So qo and re are what you are looking for.

srgbl...@gmail.com

unread,
Jul 25, 2016, 7:07:14 AM7/25/16
to sage-support
Yes it is! Many thanks.

I get the detail on the polynomial ring construction.

slelievre

unread,
Jul 25, 2016, 9:46:31 AM7/25/16
to sage-support
To complement Dima's answer, you can use // and %
to get the quotient and the remainder individually.

sage: _.<z0> = GF(2)[]

sage: K.<z> = GF(2^8, modulus=z0^8+z0^4+z0^3+z0+1)

sage: R.<x> = K[]

sage: l = x^4 + 1

sage: c = (z+1)*x^3+x^2+x+(z)

sage: l.quo_rem(c)

((z^7 + z^6 + z^5 + z^4 + z^2 + z)*x + z^6 + z^4 + z,

 (z^7 + z^5 + z^2)*x^2 + (z^7 + z^5 + z^2 + 1)*x + z^7 + z^5 + z^2 + 1)

sage: l // c

(z^7 + z^6 + z^5 + z^4 + z^2 + z)*x + z^6 + z^4 + z

sage: l % c

vetim Halimi

unread,
Mar 17, 2017, 1:53:22 PM3/17/17
to sage-support
Can you help for thatt:
 
sage: P2.<x> = GF(2)[];
sage: print (x^8 + x^6 + x^3 + x^2 + 1).is_irreducible() 
sage: p = x^8 + x^4 + x^3 + x^2 + 1; #twofish irreducible pol
sage: GF256 = GF(2^8, 'X', modulus=p)
sage: GF256([1,0,1,1,0,1,0,1]);
 
i dont know how to divided that  GF256([1,0,1,1,0,1,0,1]) with irreducible polynom
Reply all
Reply to author
Forward
0 new messages