Ask Your Question
1

Series Reversion [closed]

asked 2014-07-20 12:43:52 +0200

jjack gravatar image

updated 2014-07-23 05:52:04 +0200

slelievre gravatar image

I have a rational polynomial f(z) = P(z)/Q(z) which I want to revert (I'm trying to find the inverse of f).

I'll pick a simple example, the function f(z) = (1/z-1)^4

sage: z = var('z')
sage: z = FractionField(PolynomialRing(QQ, 'z')).objgen()
sage: f(z) = (1/z-1)^4
sage: g = f(z).taylor(x,2,4); #I expand f in a Taylor series just to make sure it's a series
sage: f.expand().reversion()
AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'reversion'
sage: g1 = g.power_series(QQ)
TypeError: denominator must be a unit
sage: g.reversion()
AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'reversion'

A power series P(z) is not a rational function P(z)/Q(z). That's why the TypeError: denominator must be a unit appears.

Is it possible that Sage cannot invert rational polynomials? In the Sage help text the computation is passed to pari first, before using Lagrangian inversion.

I thought Sage uses FLINT. Why is it not used for computing the inverse of rational polynomials?


EDIT (after answer by slelievre):

My problem now is how to avoid using the Symbolic Ring. I'm trying to do the following:

I want to invert an approximation formula for the Gamma-function. I am using Spouge's approximation. It has terms in the numerator and the denominator. Ithink I can compute them separetely per se, but what if I wanted to do a Pade approximation of the function

sage: f = (z+13)^(z+1/2)*exp(z)

sage: g = f.pade(5,5)

(it's the term ahead of the sum term in Spouge's approximation)

How do I get separate polynomials for the numerator and the denominator that are defined in the right algebraic structure?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by jjack
close date 2014-07-24 20:36:14.735427

Comments

I added a line with what y(x) looks like.

jjack gravatar imagejjack ( 2014-07-20 16:43:13 +0200 )edit

This is not sufficient for me to get the error. Please give all instructions necessary to reproduce the error from a fresh Sage session.

rws gravatar imagerws ( 2014-07-21 07:50:26 +0200 )edit

see above for the instructions

jjack gravatar imagejjack ( 2014-07-21 21:50:23 +0200 )edit

Note: (a) using Sage in a terminal will allow you to post your code by an easy copy-paste (where the input will have the `sage: ` prompt and the output will be mixed in with the input). (b) I edited the code in your original question to make it display better. (c) I added your follow-up question as an edit to your main question rather than an answer to your original question.

slelievre gravatar imageslelievre ( 2014-07-22 15:27:49 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2014-07-22 05:48:40 +0200

slelievre gravatar image

updated 2021-06-23 11:06:19 +0200

Composition inverse of a power series

The symbolic ring has its strengths mostly in calculus.

Sage also implements a wealth of algebraic structures, some of which are more suited to the task at hand here.

A worked out example

Manipulate polynomials and rational fractions in the corresponding structures. Define

sage: R.<z> = PolynomialRing(QQ)
sage: F = FractionField(R)
sage: S = PowerSeriesRing(QQ,'z')

and check the result:

sage: R
Univariate Polynomial Ring in z over Rational Field
sage: F
Fraction Field of Univariate Polynomial Ring in z over Rational Field
sage: S
Power Series Ring in z over Rational Field

Define your polynomials and rational fractions.

sage: a = 2 - 3*z + z^2
sage: b = z
sage: f = a / b

Check what you get.

sage: a
z^2 - 3*z + 2
sage: b
z
sage: f
(z^2 - 3*z + 2)/z

Check out where a, b, f live.

sage: a.parent()
Univariate Polynomial Ring in z over Rational Field
sage: b.parent()
Univariate Polynomial Ring in z over Rational Field
sage: f.parent()
Fraction Field of Univariate Polynomial Ring in z over Rational Field

Want the Taylor series at 1 of f, and its inverse under composition.

First shift the function to move to the point 1.

sage: g = f(1+z)
sage: g
(z^2 - z)/(z + 1)

Move to the ring of power series.

sage: gg = S(g)

Check the first few terms.

sage: gg + O(z^8)
-z + 2*z^2 - 2*z^3 + 2*z^4 - 2*z^5 + 2*z^6 - 2*z^7 + O(z^8)

The constant term is zero and the coefficient of z is nonzero: we can compute the composition inverse.

sage: hh = gg.reversion()

Examine the first few terms.

sage: hh + O(z^8)
-z + 2*z^2 - 6*z^3 + 22*z^4 - 90*z^5 + 394*z^6 - 1806*z^7 + O(z^8)

Check that hh is the composition inverse of gg:

sage: hh(gg)
z + O(z^21)
sage: gg(hh)
z + O(z^21)

EDIT (to answer your follow-up question).

If you have a rational fraction g, then gnum = g.numerator() and gden = g.denominator() will get you the polynomials for the numerator and the denominator of g. You can check where they live by gnum.parent() and gden.parent(). If you need them to be in R, F or S, just do R(gnum), F(gnum), S(gnum), etc.

edit flag offensive delete link more

Comments

Thanks a lot for your help. I think I got the hang of it.

jjack gravatar imagejjack ( 2014-07-23 20:38:52 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2014-07-20 12:43:52 +0200

Seen: 1,057 times

Last updated: Jun 23 '21