# Series with symbolic powers

Is there any way to perform series analysis with functions containing symbolic powers of their argument?

For example, suppose I have a function

f[x_] := f0 + f1 x^n + f2 x^(n+1) + O[x]^(n+2);


And I have this kind of equation:

x^2 f''[x] - f[x] + g[x] x^k == 0


where

g[x_] := g0 + g1 x + g2 x^2 + O[x]^3


I want to extract series coefficients of the equation above in order to set them to zero separately and establish relations between coefficients g0, g1, g2, f0, f1, f2.

Is this possible if the powers $k$ and $n$ are symbolic integer powers and all that I know is that $k \ge 0, n \ge 0$ and they are integer? I tried to do this directly, but function

Series


does not work because of nonnumeric power, whereas function

Coefficient


returns incorrect result where, for instance, coefficient in front of $x^n$ contains terms with numeric powers of $x$ like $x^2$.

f[x_, n_] = f0 + f1 x^n + f2 x^(n + 1) + O[x]^(n + 2);