Creating a polynomial from a string with symbolic constants
Below is some code that does the following. First, define R to be the univariate polynomial ring Q_2[x], and let f(x) be the polynomial x^2 - 2 in this ring. Then let K be the totally ramified quadratic extension defined by this polynomial, and call its generator a. Let S be the polynomial ring K[y]. Then I would like to define a polynomial y + a in S. This works find if I write f1 = S(y+a), but it fails if I try f2 = S('y + a'). However, I need to be able to define my polynomial from a string as in the f2 case. Can anyone help?
R.<x> = Qp(2,100)[]
f = R(x^2 - 2)
K.<a> = Qp(2,100).ext(f)
S.<y> = K[]
# The next line works
f1 = S(y + a)
# The next one throws an error
f2 = S('y + a')
Why do you need to define a polynomial from a string? Sounds like it could be an XY problem.