First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

As

sage: R = PolynomialRing(GF(32), 'x')
sage: x = R.gen()
sage: fx = x^2 + x
sage: fx.substitute(x=1)
0
click to hide/show revision 2
No.2 Revision

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