Ask Your Question

# Revision history [back]

### How do I code a Laurent Series with variable coefficients?

I am attempting to construct a LaurentSeriesRing with variable coefficients. However, I keep encountering TypeErrors, I am wondering if a kind soul could help me in my quest. I will use here a very simple polynomial f to get the point across.

sage: R.<t> = LaurentSeriesRing(QQ, 't')
sage: var('a')
a
sage: f = 1 + a*t
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-31-06d3f2f41e45> in <module>()
----> 1 f = Integer(1) + a*t

sage/structure/element.pyx in sage.structure.element.Element.__mul__ (/usr/lib/sagemath//src/build/cythonized/sage/structure/element.c:12443)()

sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/usr/lib/sagemath//src/build/cythonized/sage/structure/coerce.c:10496)()

TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and 'Laurent Series Ring in t over Rational Field'


I also tried:

sage: R.<u> = QQ[]
sage: var('a')
a
sage: f = 1 + a*u
sage: ff = derivative(f, u)
sage: R.<u> = LaurentSeriesRing(QQ); R
sage: f/ff + O(u^5)
----------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-28-c4846de7ced8> in <module>()
----> 1 f/ff + O(u**Integer(5))

sage/structure/element.pyx in sage.structure.element.Element.__add__ (/usr/lib/sagemath//src/build/cythonized/sage/structure/element.c:11198)()

sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/usr/lib/sagemath//src/build/cythonized/sage/structure/coerce.c:10496)()

TypeError: unsupported operand parent(s) for '+': 'Symbolic Ring' and 'Laurent Series Ring in u over Rational Field'


### How do I code a Laurent Series with variable coefficients?

Edit: Adding more context.

I am attempting the following procedure:

1. Begin with a polynomial $Z(u)$ with variable coefficients, of the form $1 + au + bu^2 + cu^3 + pbu^4 + p^2au^5 + p^3u^6$.
2. Examine the coefficients of $Z'(u)/Z(u)$ as a power series in $u$.

It is this quest which leads me to attempt to construct a LaurentSeriesRing with variable coefficients. However, I keep encountering TypeErrors, I am wondering if a kind soul could help me in my quest. I will use here a very simple polynomial f to get the point across.

I am attempting to construct a LaurentSeriesRing with variable coefficients. However, I keep encountering TypeErrors, I am wondering if a kind soul could help me in my quest. I will use here a very simple polynomial f to get the point across.

sage: R.<t> = LaurentSeriesRing(QQ, 't')
sage: var('a')
a
sage: f = 1 + a*t
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-31-06d3f2f41e45> in <module>()
----> 1 f = Integer(1) + a*t

sage/structure/element.pyx in sage.structure.element.Element.__mul__ (/usr/lib/sagemath//src/build/cythonized/sage/structure/element.c:12443)()

sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/usr/lib/sagemath//src/build/cythonized/sage/structure/coerce.c:10496)()

TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and 'Laurent Series Ring in t over Rational Field'


I also tried:

sage: R.<u> = QQ[]
sage: var('a')
a
sage: f = 1 + a*u
sage: ff = derivative(f, u)
sage: R.<u> = LaurentSeriesRing(QQ); R
sage: f/ff + O(u^5)
----------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-28-c4846de7ced8> in <module>()
----> 1 f/ff + O(u**Integer(5))

sage/structure/element.pyx in sage.structure.element.Element.__add__ (/usr/lib/sagemath//src/build/cythonized/sage/structure/element.c:11198)()

sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/usr/lib/sagemath//src/build/cythonized/sage/structure/coerce.c:10496)()

TypeError: unsupported operand parent(s) for '+': 'Symbolic Ring' and 'Laurent Series Ring in u over Rational Field'