Ask Your Question

Revision history [back]

If all you care about is the string you can do str(p).replace('x','n').

sage: R.<x> = ZZ[]
sage: p = 16*x^5 - 20*x^3 + 5*x
sage: p
16*x^5 - 20*x^3 + 5*x
sage: str(p).replace('x','n')
'16*n^5 - 20*n^3 + 5*n'