       RE: Simplifying Finite Sums With A Variable # of Terms

• To: mathgroup at smc.vnet.net
• Subject: [mg21793] RE: [mg21744] Simplifying Finite Sums With A Variable # of Terms
• From: "Harvey P. Dale" <hpd1 at is2.nyu.edu>
• Date: Thu, 27 Jan 2000 22:57:31 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```	Here's one way to do what I think you want to do.  I'll show the
steps separately, and then put them all together.
First, generate the series of partial sums:
In:= FoldList[Plus, 0, Range]
Out= {0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55}
Second, partition the list into groups of adjacent terms:
In:= Partition[%, 2, 1]
Out= {{0, 1}, {1, 3}, {3, 6}, {6, 10}, {10, 15}, {15, 21}, {21, 28},
{28, 36}, {36, 45}, {45, 55}}
Third, map the difference between adjacent terms into the list:
In:= {#[], #[], #[] - #[]} & /@ %
Out= {{0, 1, 1}, {1, 3, 2}, {3, 6, 3}, {6, 10, 4}, {10, 15, 5}, {15, 21,
6},
{21, 28, 7}, {28, 36, 8}, {36, 45, 9}, {45, 55, 10}}
Fourth, transpose the result and select the list of differences:
In:= Transpose[%][]
Out= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Putting this all together:
Transpose[{#[], #[], #[] - #[]} & /@ Partition[FoldList[Plus, 0,
Range],2,1]][]
Hope that helps.
Harvey

-----Original Message-----

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?

Thanks,

AC

```

• Prev by Date: Re: Making a function dynamically define another conditional function...
• Next by Date: Re: Making a function dynamically define another conditional function...
• Previous by thread: Re: Simplifying Finite Sums With A Variable # of Terms
• Next by thread: save notebook without output