Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

subs a list with another list

I define

x = [var('x_%d' % k) for k in range(p)]
y = [var('y_%d' % k) for k in range(p)]
z =x + y
PRz = PolynomialRing(QQ,z)

with $p$ arbitrary, then I need new variables, to comare polynomials, define as:

t = [z[k] + 1/z[k] for k in range(p)]

Is there a way to substitute the list of variables $z$ with the list of varialbes $t$? The only way that I could do it was as

polynomial.subs(y_0 = t[0]/2, y_1 = t[1]/2, y_2 = t[2]/2, y_3 = t[3]/2)

But I want it for a general number of variables.