Ask Your Question

Revision history [back]

As

sage: R = PolynomialRing(GF(32), 'x')
sage: x = R.gen()
sage: fx = x^2 + x
sage: fx.substitute(x=1)
0

As

sage: R = PolynomialRing(GF(32), 'x')
sage: x = R.gen()
sage: fx = x^2 + x
sage: fx.substitute(x=1)
0

Note that - symbolic variables (declared with var) are better not mixed with polynomial rings - the arguments syntax for substitute is via kewords. In other words x=1 and not x==1. In the case of symbolic functions the second syntax is allowed because x==1 is a symbolic expression itself. Compare

sage: x = SR.var('x')
sage: x == 1   # result is an expression
x == 1
sage: R = PolynomialRing(GF(32), 'x')
sage: x = R.gen()
sage: x == 1    # result is a boolean
False