1 | initial version |
Usually, in such situation i'm doing the following:
P.<x, w,winv, y, z,zinv> = PolynomialRing(QQ)
J = P.ideal([x*winv, y*zinv, w*winv - 1, z*zinv -1])
R = P.quotient_ring(J)
S.<t> = PowerSeriesRing(R)
In words, always introduce a variable for the inverse of some given variable.
Always arrange to have a polynomial ring having the variables (names and used variables) that i want. It is not enough to assing the names
, you also have to inject them.
Note that there is a clear distinction between "variables" as initialized by var
:
sage: var('x');
sage: type(x)
<class 'sage.symbolic.expression.Expression'>
and "variables" as used as transcendental generators of some polynomial ring:
sage: R.<x> = PolynomialRing(QQ)
sage: type(x)
<class 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint'>
Things are tricky to digest, when we type...
sage: var('x');
sage: R = PolynomialRing(QQ, names='x')
and now comes the question: What is $x$ now...?! It turns out that the $x$ is the reminiscent global variable from var('x')
:
sage: type(x)
<class 'sage.symbolic.expression.Expression'>
Why? The reason is that we have introduced R
, it has a transcendent variable, the name for it is x
, but we can only access this variable using the generators of R
so far. To have access to "the polynomial variable $x$", we have to inject variables:
sage: var('x');
sage: R = PolynomialRing(QQ, names='x')
sage: R.inject_variables()
Defining x
sage: type(x)
<class 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint'>
That message shown by the sage interpreter, Defining x
, is the needed message.
Alternatively, use the preparsed definition:
R.<x> = PolynomialRing(QQ)
to arrange for both, setting the names of $R$ - as they are shown in prints, and using the global variable with same name.