sage: R17.<x> = PolynomialRing(GF(17))
sage: f1 = R17(x + 10)
sage: f1 = x + 10
sage: f1
sage: x + 10
So now f1 is a polynomial.
But I then give a value to x
sage: x = 25
Then I try to define another polynomial f2 in the same way I defined f1
sage: f2 = R17(x + 15)
sage: f2
6
But because I have given a value 25 to x, sage doesn't seem to treat the statement as a polynomial definition.
When I try to evaluate f2 at x = 1, it doesn't do that.
sage: f2(1)
6
I have to redefine the ring before I can get further
sage: R17.<x> = PolynomialRing(GF(17))
sage: f2 = R17(x + 15)
sage: f2
x + 15
sage: f2(1)
16
Is there a simpler way to 'reset' x - i.e. remove the value it's been given, so it's treated as a variable again?
You should be able to use inject_variables:
This should reset
xto be the generator of the ring. As an alternative you should also be able to useto explicitly reset the variable
xto refer to the first generator of the ring.