1
$\begingroup$

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?

$\endgroup$

1 Answer 1

1
$\begingroup$

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

enter image description here

$\endgroup$
4
  • $\begingroup$ 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? $\endgroup$ Commented Apr 20, 2017 at 14:39
  • $\begingroup$ 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]. $\endgroup$
    – MikeY
    Commented Apr 20, 2017 at 15:44
  • $\begingroup$ How do I do that?..I am essentially a total newcomer to Mathematica so alot of basic stuff is still awkward for me. $\endgroup$ Commented Apr 20, 2017 at 16:21
  • $\begingroup$ ..sign and now the to\[CapitalSigma]@expr has stopped working. God this is painful. $\endgroup$ Commented Apr 20, 2017 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.