Ask Your Question

Revision history [back]

You can do this with the lift method of p, passing the ideal I as the argument:

sage: R.<x,y> = QQ[]
sage: I = R.ideal([x-1,y-1])
sage: p = x^2 - y^2 - 2*x + 2*y
sage: c = p.lift(I); c
[x - 1, -y + 1]
sage: sum(c_k*p_k for (c_k,p_k) in zip(c,I.gens()))
x^2 - y^2 - 2*x + 2*y