# Unable to obtain output in the form of a summation expression?

The following code returns a series expressed with a summation symbol$\sum$:

expr = -t^Range[0, 5] // Total

to\[CapitalSigma][expr_Plus] :=
Block[{n},
HoldForm[Sum[#, {n, #2}]] & @@ {FindSequenceFunction[List @@ expr,
n], Length@expr}]

to\[CapitalSigma]@expr


Out[1]: $-1 - t - t^2 - t^3 - t^4 - t^5$

Out[2]: $\sum_n^6 -t^{-1+n}$

So I tried to use it to obtain a summation expression for $\frac{1}{1-y}$:

expr = Series[1/(1 - y), {y, 0, 5}]
to\[CapitalSigma][expr_Plus] :=
Block[{n},
HoldForm[Sum[#, {n, #2}]] & @@ {FindSequenceFunction[List @@ expr,
n], Length@expr}]

to\[CapitalSigma]@expr


But I received the following output:

Out[1]: $1+y+y^2+y^3+y^4+y^5+O[y]^6$

Out[2]: $\text{to}\sum[1+y+y^2+y^3+y^4+y^5+O[y]^6]$

I don't want this expanded form $1+y+y^2+\dots$. How can I make Mathematica provide the proper summation expression which would be something like: $$\sum_{j=0}^\infty y^j$$

Can this be done?

You just need to "normalize" the output of the Series[ ] command to drop the Higher Order Terms expression, and it works.

    expr = Series[1/(1 - y), {y, 0, 5}] //Normal

1 + y + y^2 + y^3 + y^4 + y^5


then running

    to\[CapitalSigma]@expr


gave me

• Ok great! I just tried on another function though ant it doesn't work for this one - f[z_] := Log[y - z] Series[f[z], {z, 0, 3}] // Normal to\[CapitalSigma]@expr - Any idea why it doesn't work for this one? Apr 20 '17 at 14:39
• when it expands the Log[y-z] into a series, the series is... Log[y] - z/y - z^2/(2 y^2) - z^3/(3 y^3) so you'd need a way to strip off that Log[y]. Apr 20 '17 at 15:44
• How do I do that?..I am essentially a total newcomer to Mathematica so alot of basic stuff is still awkward for me. Apr 20 '17 at 16:21
• ..sign and now the to\[CapitalSigma]@expr has stopped working. God this is painful. Apr 20 '17 at 16:23