Ask Your Question
0

How to divide two polynomials in GF(2)[x] and get result in same type as of operands [closed]

asked 2023-11-24 06:26:49 +0200

Akhilesh gravatar image

Suppose i have two polynomials $f,g$ from GF(2)[x] which is having type class 'sage.rings.polynomial.polynomial_gf2x.Polynomial_GF2X'.

When i find $f/g$ (if $f$ is divisible by $g$ in GF(2)[x]) , it is coming as the type class 'sage.rings.fraction_field_element.FractionFieldElement_1poly_field'

How to convert $f/g$ to the same type class as of $f$ and $g$?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Akhilesh
close date 2023-12-11 13:00:43.279839

1 Answer

Sort by ยป oldest newest most voted
4

answered 2023-11-24 13:11:16 +0200

rburing gravatar image

updated 2023-11-24 13:12:53 +0200

Like this:

sage: R.<x> = PolynomialRing(GF(2))
sage: f = x^3 - 1
sage: g = x - 1
sage: f // g
x^2 + x + 1
sage: type(f // g)
<class 'sage.rings.polynomial.polynomial_gf2x.Polynomial_GF2X'>
sage: (f // g).parent() is R
True

Or if you have an element of the fraction field which equals a fraction with a unit in the denominator, you can convert it into an element of R:

sage: R(f / g)
x^2 + x + 1
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-11-24 06:26:49 +0200

Seen: 117 times

Last updated: Nov 24 '23