# How to simplify power series in terms of functions

For example, after some computations mathematica outputs

$$\sum_{k=0}^{\infty} \frac{k g_k z^{k+4}}{(1-z)^3}$$

and we assume that

$$G(z)= \sum_{k=0}^{\infty} g_k z^k$$

so the question is: how to force mathematica to simplify the first sum into the form

$$\frac{z^5}{(1-z)^3} G'(z)$$

Edit: In fact, the sequence g[k] and its generating function G[z] are unknown and I would keep them in a symbolic way. So the Mathematica code could look like this:

G[z_] := Sum[g[k]*z^k, {k, 0, \[Infinity]}]
Some_function[Sum[k*g[k]*z^{k + 4}/(1 - z)^3, {k, 0, \[Infinity]}]]

z^5/(1-z)^3 G'[z]


I mean, after defining function G[z] (maybe it should be defined in some other way), one can use Some_function to transform some series into the formula that operates on the function G[z]. So the question is how to write such Some_function?

I hope that clarify the problem.

-
Hi, please provide Mathematica code too. –  Kuba Apr 30 at 10:15

It is not quite clear, why are you looking for such an operation. I can guess about at least two reasons. First, you hope to have a command that will do such an operation with any series automatically. In this case I cannot help.

Another possibility is that you have an expression containing this or such sub-expressions, and you would like to simplify them using the method you have shown, doing it directly on the screen. This may enable you to make further operations without retyping. If this is your aim, you might do as follows:

    expr1 = Sum[(k*g[k]*z^(k + 4))/(1 - z)^3, {k, 0, Infinity}];
expr2 = z^5/(1 - z)^3*MapAt[Divide[#, z^5/(1 - z)^3] &, expr1, {1}]


and then you may make the following replacement:

expr2 /.Sum[Times[k,Power[-1,k]],g[k],List[k,0,DirectedInfinity[1]]]->G'[z]


The result is

(*  (z^5 Derivative[1][G][z])/(1 - z)^3  *)


as you wanted

-