# how to evaluate a polynomial in a quotient ring ?

I define a polynomial ring and its quotient by an ideal:

sage: F = ZZ.quo(3*ZZ); F
Ring of integers modulo 3
sage: A.<X, Y, Z> = PolynomialRing(F); A
Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
sage: R.<x, y, z> = A.quotient(ideal(X^2 - 1, Y^2 - 1, Z^2 - 1)); R
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)


I define an element in this quotient ring:

sage: f = x*y*z; f
x*y*z
sage: f.parent()
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)


I want to evaluate this element at $(x, y, z) = (2, 3, 4)$.

I tried this, and got this error message:

sage: f(2, 3, 4)
Traceback (most recent call last)
...
TypeError: 'QuotientRing_generic_with_category.element_class' object is not callable


How can I calculate f(2, 3, 4) with Sage?

edit retag close merge delete

Sort by » oldest newest most voted

Polynomials in the polynomial ring A can be called as functions.

Elements in the quotient ring R cannot.

So one solution is to lift to A and then to evaluate.

sage: F = f.lift(); F
X*Y*Z

sage: r = F(2, 3, 4); r
0

sage: r.parent()
Ring of integers modulo 3

more

Thank you very much for editing the questions, codes and for your reply to the question. I didn't know the "lift" fuinction before and this is what I need !