Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 2 years ago

Max Alekseyev gravatar image

Use order that depends on degree (eg. degrevlex), compute Grobner basis wrt such order, and check if it contains any polynomials of degree 1. Any such polynomial will gives a desired linear combination:

K = GF(2)    # can be an arbitrary field
R.<a,b> = PolynomialRing(K,order='degrevlex')
I = R.ideal(a^2-1,a*b)
print([f for f in I.groebner_basis() if f.degree()==1])