New in Wolfram Mathematica 7: Discrete Calculus  previous | next 
Find the Sum of a Piecewise Sequence
Piecewise-defined sequences can be summed provided the individual parts can be summed.
In[1]:=

Click for copyable input
pw = Piecewise[{{4 + Sin[k 2 Pi/5], k <= 12}, {k Sin[k 2 Pi/10], 

    12 < k <= 50}, {50 (-1)^k/(k - 50), k > 50}}]
Out[1]=



In[2]:=

Click for copyable input
Sum[pw, {k, 1, Infinity}]
Out[2]=



In[3]:=

Click for copyable input
DiscretePlot[pw, {k, 0, 75}]
Out[3]=