Skip to main content

differential equations - Taylor series without expanding factorial in denominator


A Taylor series is produced with the following code:


Series[Sin[x], {x, 0, 15}] 


x-x^3/6+x^5/120-x^7/5040+x^9/362880-x^11/39916800+x^13/6227020800-x^15/1307674368000+O(x^16)

Is there a simple way to prevent the factorial in each denominator from being evaluated? That is, I want an answer of the form:


$$\sin(x)=x-\frac{x^3}{3!}+\frac{x^5}{5!}+\cdots$$



Answer



s = Series[Sin[x], {x, 0, 15}] // Normal ;
s /. Times[_[a_, b_], c_] :>a (c/Inactive[Factorial][InverseFunction[Gamma][b] - 1])

Note:



The above method will not work for any function


This works for any function:


s /. Times[a_, Power[_, b_]] :> (a x^b) (b!)/Inactive[Factorial][b]

Comments