Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

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.