way to subs var by matrix in polynomial
HI
What is the best way to substitute to the variables of a polynomial x, y with 2 matrices X, Y
R.<x,y> = QQ[]
p = x^2 + 5*y + 2*x*y + 3*x + y^2
show("p : ",p," \t degre : \t",p.degree(x))
for ex in range(1,p.degree(x)+1) :
coefx=p.coefficient(x^ex)
print(" ex : ",ex," \t coefx : ",coefx)
for ey in range(1,p.degree(x)+1) :
coefy=p.coefficient(y^ey)
print(" ey : ",ey," \t coefy : ",coefy)
#for ey in range(1,p.degree(y)+1) :
# coefy=p.coefficient(y^ex)
# for ex in range(0,coefy.degree(y)+1) :
# coefx=p.coefficient(x^ex)
# print(" ex : ",ex," \t coefx : ",coefx," \t ey : ",ey," \t coefy : ",coefy)
var('x_00,x_01,x_10,x_11',domain='integer')
var('y_00,y_01,y_10,y_11',domain='integer')
X=matrix(SR,[[x_00,x_01],[x_10,x_11]]); Y=matrix(SR,[[y_00,y_01],[y_10,y_11]])
show(X,Y)
#p.subs([x==X,y==Y])