Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

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[1]:= FoldList[Plus, 0, Range[10]]
Out[1]= {0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55}
	Second, partition the list into groups of adjacent terms:
In[2]:= Partition[%, 2, 1]
Out[2]= {{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[3]:= {#[[1]], #[[2]], #[[2]] - #[[1]]} & /@ %
Out[3]= {{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[4]:= Transpose[%][[3]]
Out[4]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
	Putting this all together:
Transpose[{#[[1]], #[[2]], #[[2]] - #[[1]]} & /@ Partition[FoldList[Plus, 0,
Range[10]],2,1]][[3]]
	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[1]+x[2]+...+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[0] .

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