# Series expansion [closed]

I have a very complicated polynomials and functions, which has the structure

$$\sum_{n,m}\frac{A_{n,m}}{(1-y)^n(y)^m} \tag 1 \label{1}$$

I would like to put it in this eq.(\ref{1}) form, but at the end of my computation, all of these $A_{n,m}$s are combined with single common denominator (that is, I have one term).

What functions can I use to organize my output so that I get it into $(\ref{1})$ form?

Obviously, I cannot use "Series".

For instance, if I have

$$\frac{(1-y)+y}{(1-y)y} = \frac{1}{y}+\frac{1}{1-y}$$

series expansion around $y=0$ will give

$$\frac{1}{y}+1+y+y^2+\dots$$

Of course one can recognize that $$1+y+y^2+\dots = \frac{1}{1-y}$$ but it becomes impossible to recognize these things when there are many more terms.

## closed as unclear what you're asking by Michael E2, m_goldberg, MarcoB, LCarvalho, garejJun 15 '17 at 5:11

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• What are the upper and lower bounds on m,n? Can n,m be zero or negative? Do you expect m,n to go to infinity for your functions? (It seems to be a much harder problem if the series doesn't terminate.) More importantly, what kinds of functions do you expect in the numerator of your input? Polynomials should be relatively easy to deal with; more complicated functions would probably be more difficult. Perhaps you could post a representative function? (Posting in Mathematica code rather than LaTeX would be preferable.) – jjc385 Apr 14 '17 at 4:55

You didn't tell what kind the A[n,m] are. I supposed they are Integers.

Than you can use "Apart" and select all appearing denominator terms. Example

   f[y_] = 3 + -5/(-1 + y) + 2/((-1 + y)^3 y) + 6/((-1 + y)^3 y^3) //
Together

(*(6 + 2 y^2 - 8 y^3 + 19 y^4 - 14 y^5 + 3 y^6)/((-1 + y)^3 y^3)  *)

g[y_] = f[y] // Apart

(* 3 + 8/(-1 + y)^3 - 20/(-1 + y)^2 + 33/(-1 + y) - 6/y^3 - 18/y^2 - 38/y *)

Select[Flatten@Table[
Table[Solve[g[y][[j]] == A[n, m]/((y - 1)^n y^m), A[n, m]], {n, 0,3}, {m, 0, 3}], {j, 1, Length[g[y]]}] // Simplify,
NumericQ[#[[2]]] &]

(*   {A[0, 0] -> 3, A[3, 0] -> 8, A[2, 0] -> -20, A[1, 0] -> 33,
A[0, 3] -> -6, A[0, 2] -> -18, A[0, 1] -> -38}   *)


Because there is more than one possible decomposition, you get the simplest result.

If the A[n,m] are Real numbers, Rationalize g[y].

How feasible this is depends on how complicated it is, but I suspect the approach theoretically solves your problem:

SeedRandom[0];
rat = Sum[RandomInteger[{-2, 2}]/((1 - y)^n y^m), {n, 0, 10}, {m, 0, 10}];

SeriesCoefficient[rat, {y, 0, n}]


Sum[SeriesCoefficient[rat, {y, 0, n}] y^n, {n, -11, Infinity}]
(*
(1/((-1 + y)^10 y^10))(3 - 27 y + 85 y^2 - 186 y^3 + 255 y^4 -
183 y^5 - 48 y^6 + 256 y^7 - 215 y^8 - 91 y^9 + 498 y^10 -
883 y^11 + 1153 y^12 - 1228 y^13 + 1047 y^14 - 667 y^15 +
284 y^16 - 61 y^17 - 5 y^18 + 6 y^19 - y^20)
*)


Or

Apart@Sum[SeriesCoefficient[rat, {y, 0, n}] y^n, {n, -11, Infinity}]


This also works:

 Sum[SeriesCoefficient[rat, {y, 0, n}] y^n, {n, -Infinity, Infinity}]