Ask Your Question

Revision history [back]

This looks like a bug, or at least odd behavior.

sage: B = FunctionField(QQ,'z')
sage: B.inject_variables()
Defining z
sage: g = z
sage: g.subs(z=z^3)
z
sage: g(z) = z
sage: g.subs(z=z^3)
z |--> z^3
sage: g = z
sage: g.subs(z=z^3)
z^3

Indeed, this also works:

sage: B = FunctionField(QQ,'z')
sage: B.inject_variables()
Defining z
sage: h(z) = z
sage: g = z
sage: g.subs(z=z^3)
z^3

I don't know why defining a symbolic function "activates" subs like this.

This looks like a bug, or at least odd behavior.Edit: this is not an answer to the question, but together with the comments below, it may be useful, so I will leave it here.

sage: B = FunctionField(QQ,'z')
sage: B.inject_variables()
Defining z
sage: g = z
sage: g.subs(z=z^3)
z
sage: g(z) = z
sage: g.subs(z=z^3)
z |--> z^3
sage: g = z
sage: g.subs(z=z^3)
z^3

Indeed, this This also works:"works":

sage: B = FunctionField(QQ,'z')
sage: B.inject_variables()
Defining z
sage: h(z) = z
sage: g = z
sage: g.subs(z=z^3)
z^3

I don't know why defining a symbolic function "activates" subs like this.