Ask Your Question

Revision history [back]

You can use the substitute (or subs) method. I like using a Python dict as its argument:

sage: R.<a,b,c,d> = BooleanPolynomialRing()
sage: S = R.gens()
sage: f = a*b + b*c
sage: f.subs({a:1})
b*c + b
sage: f.subs({S[0]:1})
b*c + b
sage: f.subs({S[0]:1, S[2]:a})
a*b + b