MathGroup Archive 2004

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

Search the Archive

Re: Sum question and general comment

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50700] Re: Sum question and general comment
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Fri, 17 Sep 2004 01:16:36 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 9/15/04 at 1:49 AM, stevebg at adelphia.net (Steve Gray) wrote:

>I find no way to do, for example, "Sum over i=1 to 100 except i!=
>23 and 36", etc.,

An obvious way would be to express this as three sums, i.e.,

Sum[f,{i,22}]+Sum[f,{i,24,35}]+Sum[f,{i,37,100}]

>or Sum over values belonging to a list, such as
>"Sum over i (belonging to) {1,2,3,5,7,8,21}", etc., 

This is easily done as one of the following

Plus@@(f/@list)
Total[f/@list]
Tr[f/@list]

where list is the list of values you want to sum over

In fact, this same technique can be used to solve your first problem as well, i.e.

Total[f/@Complement[Range[100],{23,36}]]
--
To reply via email subtract one hundred and four


  • Prev by Date: Statistics`NormalDistribution` doesn't work?
  • Next by Date: Re: how do I display "Power[z,-1]" in an exponetial form?
  • Previous by thread: Re: Sum question and general comment
  • Next by thread: Re: Sum question and general comment