Ask Your Question
0

How to compute the multiplicative inverse of a series?

asked 2014-11-18 15:48:08 +0100

Peter Luschny gravatar image

updated 2015-10-16 19:15:20 +0100

FrédéricC gravatar image

After a formula of Sergei N. Gladkovskii the logarithm of the generating function for the Pell numbers is the multiplicative inverse of sqrt(2) coth(sqrt(2) x)-1 seen as an exponential generating function.

In the words of Maple:

seq(k!*coeff(series(1/(sqrt(2)*coth(sqrt(2)*x)-1),x=0,k+2),x,k),k=0..9);
0, 1, 2, 2, -8, -56, -112, 848, 9088, 25216

How can I do this with Sage?

Added:

If I want a compositional inverse this is what I do:

SR -> taylor -> PowerSeriesRing(SR) -> reversion() -> egf_to_ogf() -> padded_list()

If I want a multiplicative inverse this is what I want to do:

SR -> taylor -> PowerSeriesRing(SR) -> inversion() -> egf_to_ogf() -> padded_list()

Isn't this what one expects naturally? But I cannot find an 'inversion'.

Solution d'après kcrisman

x = SR.var('x')
gf = (sqrt(2)*coth(sqrt(2)*x)-1)^-1
taylor(gf,x,0,9).power_series(SR).egf_to_ogf().padded_list()
edit retag flag offensive close merge delete

Comments

Following a hint of kcrisman I found in the code the function "__invert__(self)". This is exactly what I have been looking for. To support functional notation and to make terminology more uniform and predictable it would be nice to have an function-alias inversion() for this function.

Peter Luschny gravatar imagePeter Luschny ( 2014-11-20 14:53:38 +0100 )edit

This is now trac #17403

rws gravatar imagerws ( 2014-11-26 15:12:04 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2014-11-18 16:36:06 +0100

kcrisman gravatar image

updated 2014-11-19 04:13:25 +0100

I don't know if Maxima can do it far more directly. I also have ignored the part of your question about the factorials. But I think this should get your started with something.

sage: A(x) = 1/(sqrt(2)*coth(sqrt(2)*x)-1)
sage: B(x) = taylor(A,x,0,10)
sage: B
x |--> -1213/14175*x^10 + 197/2835*x^9 + 71/315*x^8 + 53/315*x^7 - 7/45*x^6 - 7/15*x^5 - 1/3*x^4 + 1/3*x^3 + x^2 + x
sage: C = B^-1
sage: D(x) = taylor(C,x,0,10)
sage: expand(D*B)
x |--> -1374329/86113125*x^20 + 13378492/602791875*x^19 + 4163876/120558375*x^18 + 492028/66976875*x^17 - 634988/13395375*x^16 - 970628/13395375*x^15 - 150044/13395375*x^14 + 163852/1488375*x^13 + 664336/4465125*x^12 + 1  # okay as nothing below x^11    
sage: D.coeffs()
[[1, -1],
 [-1, 0],
 [2/3, 1],
 [-4/45, 3],
 [16/945, 5],
 [-16/4725, 7],
 [-4589/42525, 9],
 [1133/6075, 10]]

Hopefully this is all right; I'm not sure about this discrepancy:

sage: A.series(x,2)
x |--> (1/(sqrt(2)*coth(0) - 1)) + (2*csch(0)^2/(sqrt(2)*coth(0) - 1)^2)*x + Order(x^2)
sage: taylor(A,x,0,2)
x |--> x^2 + x

It would be nice if Taylor also returned something with the + Order(x^2) business.

Edit now that I see what your workflow is:

sage: A = taylor(e^x,x,0,5).power_series(QQ)
sage: A
1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + O(x^6)
sage: A^-1
1 - x + 1/2*x^2 - 1/6*x^3 + 1/24*x^4 - 1/120*x^5 + O(x^6)
sage: A*A^-1
1 + O(x^6)

Hope this is what you were looking for.

If you want to know more, do

sage: A.__invert__??

which is the special thing that makes -1 powers work properly, I believe.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-11-18 15:48:08 +0100

Seen: 1,428 times

Last updated: Nov 20 '14