MathGroup Archive 1998

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

Search the Archive

Re: Re: Help please: Summing a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13587] Re: [mg13555] Re: [mg13480] Help please: Summing a list
  • From: Jon Prudhomme <prudhomj at elwha.evergreen.edu>
  • Date: Mon, 3 Aug 1998 03:53:49 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Rob, I think it would be easier to try this -

	PP=Table[Apply[Plus,Take[P,n]],{n,1,i}]

Jon Prudhomme
The Evergreen State College

On Sat, 1 Aug 1998, Keith S. Mersman wrote:

> Rob,
> 
> I think you want to do something like this:
> 
> First, set up your original table:
> 
> 	tab=Table[x,{x,0,110}]
> 
> Then, assign a name to each of these entries like:
> 
> 	Clear[P]; 
> 	Table[P[i]=tab[[i]],{i,1,111}]
> 
> This, this let P[i] be the i-1 entry in the table (labeled tab)
> 
> Now, sum these values and label the totals:
> 
> 	Table[PP[i]=Sum[P[n],{n,1,i}],{i,1,111}]
> 
> This makes PP[i] be the sum of the first i entries of the orinal table.
> 
> Now, creata a new table with these values:
> 
> 	newtab=Table[PP[i],{i,1,111}]
> 
> Hence, newtab is now a list with the ith value as the sum as the sum of
> the first i entries of tab.  Let me know if this is what you wanted.
> 
> 
> On Sun, 26 Jul 1998 robpetersonSPAMME at iname.com wrote:
> 
> > I make a list of numbers, eg:
> > 
> > P=Table[6,{x,0,110}]; (I have a more interesting list to use later if I
> > get this working)
> > 
> > Now I want to make another list PP in which each entry PP[[i]] is the
> > sum of P's first i entries.  I try
> > 
> > PP[[i]]:=Sum[P[[n]],{n,0,i}];
> > 
> > At the definition, I get the following error: Part::"pspec": 
> >     "Part specification \!\(n\) is neither an integer nor a list of
> > integers."
> > 
> > I don't know how to make n an integer.  In the definition of Sum[], it
> > seems n is an integer unless you add a forth parameter "di" in the
> > specification list such as 
> > Sum[f, {i, imin, imax, di}]
> > 
> > Can anyone help me to generate this second list?
> > 
> > Thanks, Rob
> > 
> > 
> 
> 
> 


  • Prev by Date: Re: Re: Help please: Summing a list
  • Next by Date: What is the fastest machine for Mathematica?
  • Previous by thread: Re: Re: Help please: Summing a list
  • Next by thread: What is the fastest machine for Mathematica?