Ask Your Question

Revision history [back]

Polygen and polygens

The polygens function allows to inject variables for constructing multivariate polynomials, as in:

sage: x, y = polygens(QQ, 'x, y')
sage: type(x)

And then an object like f = x^2*y^2 - 1 will also be a multivariate polynomial. But if we do instead:

sage: x = polygens(QQ, 'x')
sage: type(x)
<type 'tuple'>

We get a tuple!? Are there good reasons? I'd rather expect just a MPolynomial_libsingular, or a univariate polynomial, as with:

sage: x = polygen(QQ, 'x')
sage: type(x)
<type 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint'>