Ask Your Question

Revision history [back]

Ah, the trick is that you have to type parentheses after the method name to evaluate the method:

sage: R.<s,t> = PolynomialRing(QQ,2)
sage: f = 1 + s + t + t*s
sage: f.degree
<built-in method degree of sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular object at 0x10cb0b8c0>
sage: f.degree()
2

Note that if the method requires arguments, you put those in the parentheses:

sage: f.change_ring()
Traceback (most recent call last):
...
TypeError: change_ring() takes exactly one argument (0 given)

sage: f.change_ring(ZZ)
s*t + s + t + 1