# Transform recursion for coefficients into differential equation for generating function

Assume, one is given a linear recursion with polynomial coefficients for a sequence $(a_i)_i$, such as

a[i] == i a[i-1]


I would like to convert this recursion into a differential equation for the (formal) generating function $G(x)=\sum_{i}a_i x^i$.

In my example above, direct manipulation leads me to the equation $$G(x)=2x^2 a_1+x^2 G'(x)+xG(x)$$ which Mathematica can solve in terms of special functions. Interestingly, the power series with coefficients $i!$ (the solution to $a_i=i a_{i-1}$) doesn't converge for any $x$. Since I'm only interested in formal power series, however, I still believe that my question makes sense.

I'm particular interested in a method that also works for higher order recursions with higher degree polynomial coefficients.

Thanks.

I would like to add that I am familiar with the functions GeneratingFunction[] and RSolve[] but neither seems to be of much help for this problem.

-
GeneratingFunction[] does what I want. Apparently I wasn't sufficiently familiar with this function after all. –  Eckhard Aug 26 at 17:40