1 | initial version |
Call the Laurent polynomial ring on an element of the fraction field that turns out to live there.
Here is an example using the element f
in the question.
This should work:
sage: g = R(f)
sage: parent(g)
Univariate Laurent Polynomial Ring in q1 over Integer Ring
2 | No.2 Revision |
Call Good thing you gave the Laurent polynomial ring a name.
That makes it easy to call it on an element of the fraction field
that turns out to live there.field.
Here is an example using the element f
in the question.
This should work:
sage: g = R(f)
sage: parent(g)
Univariate Laurent Polynomial Ring in q1 over Integer Ring
3 | No.3 Revision |
Good thing you gave the Laurent polynomial ring a name.
That makes it easy to call it on an element of the fraction field.
Here is an example using the element f
in the question.
sage: g = R(f)
sage: parent(g)
Univariate Laurent Polynomial Ring in q1 over Integer Ring
In more complicated cases, it helps to use the numerator and denominator.
sage: x = (1-q1) * (1-q2) * (q2/(1-q1)+q2^-1/(1-q1^-1))
sage: x
(q2^3 - q1*q2 - q2^2 + q1)/(-q2)
sage: R(x)
Traceback (most recent call last)
...
TypeError: fraction must have unit denominator
sage: xx = R(x.numerator()) / R(x.denominator())
sage: xx
-q2^2 + q1 + q2 - q1*q2^-1
sage: parent(xx)
Multivariate Laurent Polynomial Ring in q1, q2 over Integer Ring
4 | No.4 Revision |
Good thing you gave the Laurent polynomial ring a name.
That makes it easy to call it on an element of the fraction field.
Here is an example using the element f
in the question.
sage: g ff = R(f)
sage: parent(g)
parent(f)
Univariate Laurent Polynomial Ring in q1 over Integer Ring
In more complicated cases, it helps to use the numerator and denominator.
sage: x g = (1-q1) * (1-q2) * (q2/(1-q1)+q2^-1/(1-q1^-1))
sage: x
g
(q2^3 - q1*q2 - q2^2 + q1)/(-q2)
sage: R(x)
gg = R(g)
Traceback (most recent call last)
...
TypeError: fraction must have unit denominator
sage: xx gg = R(x.numerator()) R(g.numerator()) / R(x.denominator())
R(g.denominator())
sage: xx
gg
-q2^2 + q1 + q2 - q1*q2^-1
sage: parent(xx)
parent(gg)
Multivariate Laurent Polynomial Ring in q1, q2 over Integer Ring