Ask Your Question
0

How do I code a Laurent Series with variable coefficients?

asked 2017-11-19 20:35:21 +0200

tzeentch gravatar image

updated 2017-11-22 00:04:27 +0200

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'
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-11-19 22:11:22 +0200

vdelecroix gravatar image

updated 2017-12-06 11:33:38 +0200

One possibility is to use multivariate Laurent polynomials and let one variable be your parameter

sage: R.<a,t> = LaurentSeriesRing(QQ)
sage: R
Multivariate Laurent Polynomial Ring in a, t over Rational Field

another one is to use coefficients being themselves polynomials

sage: P.<t> = PolynomialRing(QQ)
sage: R.<a> = LaurentSeriesRing(P)
sage: R
Univariate Laurent Polynomial Ring in a over Univariate Polynomial Ring in t over Rational Field

There are also several other ways but everything depends on what you want to do with them... try to make your question more precise.

EDIT: to expand a quotient (of polynomials) with parameters, the second method is more appropriate

sage: P.<t> = PolynomialRing(QQ)
sage: R.<a> = LaurentSeriesRing(P)
sage: num = (t^2 + 1) * a^2 + (-t + 2) * a + (t^2 - 1)
sage: den = (t^3 + t + 1) * a^2 + (2*t + 5) * a - 1
sage: num / den
(-t^2 + 1) + (-2*t^3 - 5*t^2 + 3*t + 3)*a + ... + O(a^20)
edit flag offensive delete link more

Comments

I am attempting to expand as a power series a quotient with variable coefficients. With this formalism, I am still unable to expand the polynomial quotient I receive (for my more complicated quotient, still in a and t) by adding + O(t^5).

tzeentch gravatar imagetzeentch ( 2017-11-20 08:41:50 +0200 )edit

Then I advice you to edit your own question starting with what you are trying to achieve together with an example of a quotient.

vdelecroix gravatar imagevdelecroix ( 2017-11-20 21:41:19 +0200 )edit

Thank you very much, your edit was a lifesaver, and now everything works!

tzeentch gravatar imagetzeentch ( 2017-11-22 00:04:45 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-11-19 20:35:21 +0200

Seen: 341 times

Last updated: Dec 06 '17