On Jun 8, 2009, at 5:50 PM, Kwankyu wrote:
> I tried change_ring(), without success...
>
> sage: R.<t>=PowerSeriesRing(QQ)
> sage: P.<x>=PolynomialRing(R)
> sage: f=t*x+t^2
> sage: g=f/t
> sage: f
> t*x + t^2
> sage: g
> x + t
> sage: f.parent()
> Univariate Polynomial Ring in x over Power Series Ring in t over
> Rational Field
> sage: g.parent()
> Univariate Polynomial Ring in x over Laurent Series Ring in t over
> Rational Field
> sage: g.change_ring(R)
> ----------------------------------------------------------------------
> -----
> TypeError Traceback (most recent call
> last)
> ...
> TypeError: Unable to coerce t (<type
> 'sage.rings.laurent_series_ring_element.LaurentSeries'>) to Rational
> sage:
>
> Now I am forced to extract coefficients of g, and reconstruct g with
> the right base ring.
This is a bug in power series construction:
sage: R(t*t^-1)
------------------------------------------------------------
Traceback (most recent call last):
...
TypeError: Unable to coerce t (<type
'sage.rings.laurent_series_ring_element.LaurentSeries'>) to Rational
In the new coercion model, there should be a coercion map from the
power series ring to the laurent series ring, with an inverse that
would (automatically) do what you want (when possible). I know Craig
Citro has been working on this code lately.
> Or I may live with laurent series base ring.
One should be able to do floor division, but that's another bug (easy
to fix) bug:
sage: f // t
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
File "polynomial_element.pyx", line 5135, in
sage.rings.polynomial.polynomial_element.Polynomial_generic_dense.__floo
rdiv__ (sage/rings/polynomial/polynomial_element.c:36448)
AttributeError: 'sage.rings.polynomial.polynomial_element.Polynomia'
object has no attribute '_new_c'
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---