# Revision history [back]

### polynomial ring over another polynomial ring

I'd like to see what one multivariate polynomial f looks like when another one g vanishes, by rewriting the former as f = r + q g and setting g = 0. In Maple, one could do that just by computing r = prem( f, g, x ) where x is one of the indeterminates of f and g, which is effectively treating f and g as univariate polynomials over the ring of polynomials in the remaining indeterminates. Unfortunately when I try to do that in Sage it gives me the following error (but perhaps there's a simpler way?):

R.<y,z> = QQ["y,z"]
S.<x> = PolynomialRing(R, "x" )
a = x^2y - x - z
a.reduce(Ideal([x
y-z]))

Error in lines 4-4
Traceback (most recent call last):
File "/cocalc/lib/python3.8/site-packages/smc_sagews/sage_server.py", line 1230, in execute
exec(
File "", line 1, in <module>
File "sage/structure/element.pyx", line 493, in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4703)
return self.getattr_from_category(name)
File "sage/structure/element.pyx", line 506, in sage.structure.element.Element.getattr_from_category (build/cythonized/sage/structure/element.c:4815)
return getattr_from_other_class(self, cls, name)
File "sage/cpython/getattr.pyx", line 372, in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2620)
raise AttributeError(dummy_error_message)
AttributeError: 'sage.rings.polynomial.polynomial_element.Polynomial_generic_dense' object has no attribute 'reduce'

 2 None slelievre 17654 ●22 ●160 ●348 http://carva.org/samue...

### polynomial ring over another polynomial ring

I'd like to see what one multivariate polynomial f $f$ looks like like when another one g $g$ vanishes, by rewriting the former former as f $f = r + q g g$ and setting g = 0. $g = 0$. In Maple, one could do that that just by computing r = prem( f, g, x ) ) where x x is one of the the indeterminates of f f and g, g, which is effectively treating f f and g g as univariate polynomials over the ring of polynomials polynomials in the remaining indeterminates. Unfortunately when I try to do do that in Sage it gives me the following error (but perhaps there's there's a simpler way?):way?).

R.<y,z> = QQ["y,z"]
Input:

R.<y, z> = QQ['y, z']
S.<x> = PolynomialRing(R, "x" ) 'x')
a = x^2y x^2*y - x - z
a.reduce(Ideal([xy-z]))z
a.reduce(Ideal([x*y-z]))


Error:

Error in lines 4-4 4-4
Traceback (most recent call last):
File "/cocalc/lib/python3.8/site-packages/smc_sagews/sage_server.py", last):
File "/cocalc/lib/python3.8/site-packages/smc_sagews/sage_server.py",
line 1230, in execute
exec( execute
exec(
File "", line 1, in <module> <module>
File "sage/structure/element.pyx", line 493, in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4703) 493,
in sage.structure.element.Element.__getattr__
(build/cythonized/sage/structure/element.c:4703)
return self.getattr_from_category(name) self.getattr_from_category(name)
File "sage/structure/element.pyx", line 506, in sage.structure.element.Element.getattr_from_category (build/cythonized/sage/structure/element.c:4815) 506,
in sage.structure.element.Element.getattr_from_category
(build/cythonized/sage/structure/element.c:4815)
return getattr_from_other_class(self, cls, name) name)
File "sage/cpython/getattr.pyx", line 372, in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2620) 372,
in sage.cpython.getattr.getattr_from_other_class
(build/cythonized/sage/cpython/getattr.c:2620)
raise AttributeError(dummy_error_message)
AttributeError: 'sage.rings.polynomial.polynomial_element.Polynomial_generic_dense' AttributeError(dummy_error_message)
AttributeError:
'sage.rings.polynomial.polynomial_element.Polynomial_generic_dense'
object has no attribute 'reduce'  
'reduce'