# Polynomial Ring in Sage

Hello, I want to use this code in my python script, but it return error:

from sage.all import * var('x') R = ZZ['x'] f = 3*x**2 - 3*x**8 g = x**2 - 1 print g.degree(x) h = f.mod(x**2 - 1) print h.degree(x) print f.quo_rem(g)

and error:

2 8 Traceback (most recent call last): File "degree.py", line 15, in <module> print f.quo_rem(g) File "sage/structure/element.pyx", line 438, in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4406) File "sage/structure/misc.pyx", line 257, in sage.structure.misc.getattr_from_other_class (build/cythonized/sage/structure/misc.c:1631) AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'quo_rem'

What's the problem I can't use this commands in my script? And also note the the result of

h = f.mod(x**2 - 1)is incorrect!

add a comment