Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
0

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

asked 1 year ago

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?

Preview: (hide)

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 1 year ago

rburing gravatar image

updated 1 year ago

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
Preview: (hide)
link

Question Tools

1 follower

Stats

Asked: 1 year ago

Seen: 360 times

Last updated: Nov 24 '23