       Re: Simplifying Finite Sums With A Variable # of Terms

• To: mathgroup at smc.vnet.net
• Subject: [mg21771] Re: [mg21744] Simplifying Finite Sums With A Variable # of Terms
• From: "Tomas Garza" <tgarza at mail.internet.com.mx>
• Date: Thu, 27 Jan 2000 22:56:52 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```
Wretch [arc at astro.columbia.edu] wrote:

> Hello.  I'm a user of Mathematica 3.0.  A simple example of
> what I'd like to do is as follows:
>
> Suppose you have the finite series
>
> S[i_]=Sum[x[k],{k,1,i}]
>
> which is equal to   x+x+...+x[i], where the total # of
> terms i is left variable.
>
> I'd like mathematica to calculate the difference
>
> S[N]-S[N-1] = x[N]-x .
>
> I've tried commands like
>
> Expand[S[N]-S[N-1]]  and  Simplify[S[N]-S[N-1]] ,
>
> but mathematica doesn't simplify it as you would expect.
> It basically does nothing.  I suspect that it needs some
> sort of clarification as to the nature of N (i.e. it's a
> positive integer), but I'm not sure.  Is there an easy
> way for me to do what I'd like?

it is not included in the definition of S (the iterator therein is {k,1,i}).

Then, using e.g. CumulativeSums in the Statistics`DataManipulation` AddOn to
define the sums,

In:=
<< Statistics`DataManipulation`
In:=
s[q_List] := CumulativeSums[q]
In:=
z[q_List] := Prepend[Drop[s[q], -1], 0]

so that, for any list q, the difference s[q] - z[q] will give the list
{S, S - S,S - S,..., S[k] - S[k-1]} = q. Take, for example,

In:=
q = {a, b, c, d}
Out
{a, b, c, d}

In:= s[u]
Out=
{a, a + b, a + b + c, a + b + c + d}

In:=
s[q] - z[q]
Out=
{a, b, c, d}

Tomas Garza
Mexico City

```

• Prev by Date: Re: Efficient Replacement Rules to Matrix?
• Next by Date: Re: Could this be improved?
• Previous by thread: Simplifying Finite Sums With A Variable # of Terms
• Next by thread: RE: Simplifying Finite Sums With A Variable # of Terms