# Revision history [back]

When you write b1(y1,y2)= y1 this defines b1 as a symbolic function, not a polynomial. Note the difference

sage:     b1(y1,y2)= y1
sage: type(b1)
<class 'sage.symbolic.expression.Expression'>
sage: R.<y1,y2> = PolynomialRing(GF(3))
sage: b1 = y1
sage: type(b1)
<class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>


Because these are different they behave differently.

Something like this might achieve what you want

R.<y1, y2> = PolynomialRing(GF(3))   # NOTE: don't use series but polynomials
I = R.ideal(y1^3, y2^3)
S = R.quotient_ring(I)

# NOTE: use Python functions
# group action
def transform(poly):
return S(poly.lift().subs(y1=y1 + 1, y2=y2 - y1^2 - y1))

#defining the basis
E = list(map(S, [1, y1, y1^2, y1*y2, y2, y2^2, y1^2*y2, y1*y2^2, y1^2*y2^2]))
indices = {monom: i for i, monom in enumerate(B)}

mat = []
for poly in B:
v =  * len(B)
image = transform(poly).lift()
for c, m in zip(image.coefficients(), image.monomials()):
v[indices[m]] = c
mat.append(v)
mat = matrix(mat).transpose()
print(mat)


When you write b1(y1,y2)= y1 this defines b1 as a symbolic function, not a polynomial. Note the difference

sage:     b1(y1,y2)= y1
sage: type(b1)
<class 'sage.symbolic.expression.Expression'>
sage: R.<y1,y2> = PolynomialRing(GF(3))
sage: b1 = y1
sage: type(b1)
<class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>


Because these are different they behave differently.

Something like this might achieve what you wantIn the following snippet, I show how to compute the matrix of g, that is [g(1), g(y1), g(y1^2), ...]

R.<y1, y2> = PolynomialRing(GF(3))   # NOTE: don't use series but polynomials
I = R.ideal(y1^3, y2^3)
S = R.quotient_ring(I)

# NOTE: use Python functions
# group action
def transform(poly):
return S(poly.lift().subs(y1=y1 + 1, y2=y2 - y1^2 - y1))

#defining # defining the basis
E basis together with an inverse map
B = list(map(S, [1, y1, y1^2, y1*y2, y2, y2^2, y1^2*y2, y1*y2^2, y1^2*y2^2]))
indices = {monom: i for i, monom in enumerate(B)}

mat = []
for poly in B:
v =  * len(B)
image = transform(poly).lift()
for c, m in zip(image.coefficients(), image.monomials()):
v[indices[m]] = c
mat.append(v)
mat = matrix(mat).transpose()
print(mat)