Really, this is two questions in one.
Suppose I have the following code:
from sympy import *
x1, x2, x3, y1, y2, y3 = symbols("x1 x2 x3 y1 y2 y3")
term = x1**5 + (x2**2)*(x3**3) + x1**4 + x1**3 + x1**2 + x1
term = term.subs(x1**2, y1)
term = term.subs(x2**2, y2)
term = term.subs(x3**2, y3)
After the above, term takes the value x1**5 + x1**3 + x1 + x3**3*y2 + y1**2 + y1.
Question 1: I would like to turn all x_i^(2n+1) into the form x_i*(y_i^n) - but this leaves the odd powers of x_i alone. Is there any way to achieve this?
Question 2: Is there a way of typing something like term = term.subs(xi**2, yi), rather than rewriting the substitution for each x_i?

