       Re: Is it possible to impose a condition on an iterator of

• To: mathgroup at smc.vnet.net
• Subject: [mg101606] Re: [mg101499] Is it possible to impose a condition on an iterator of
• From: "Elton Kurt TeKolste" <tekolste at fastmail.us>
• Date: Fri, 10 Jul 2009 23:24:22 -0400 (EDT)
• References: <200907090552.BAA16854@smc.vnet.net>

```Sum need not use an arithmetic progression of its indices -- any set
will do:

In:= Sum[f[i],{i,{1,5,7,3,30,whatever}}]
Out= f+f+f+f+f+f[whatever]

So the solution is to specify only the indices desired, in your case:

In:= Sum[f[i], {i, Union[Range, Range[13, 20]]}]
Out=
f+f+f+f+f+f+f+f+f+f+f+f+f+f

In:= f[a_]:=a^2-3 a/(4 a^2);Sum[f[i], {i, Union[Range, Range[13,
20]]}]
Out= 68197048951/28217280

There is a caveat, of course: if the range of indices is inherent to the
function and not incidental to the particular sum, then the restriction
should be built into the function:

In:= f[a_/;6<a<13]:=0;f[a_]:=a^2-3 a/(4 a^2);
Sum[f[i],{i,Range}]
Out= 65147819131/28217280

Kurt TeKolste

On Wed, 08 Jul 2009 21:52 -0400, "Mauro" <mauro at NONOyahoo.com> wrote:
> I would like to perform a summation of this type,
>
> Sum[a^2 - 3 a/(4 a^2), {a, 1, 20}]
>
> excluding however some values of the iteratore, I would for instance
> like to exclude the values than to greater of 6 and inferior to 12. Is
> it possible?
>
> Thanks
>

```

• Prev by Date: Re: Fast calculation of pair correlation function
• Next by Date: Re: Help with FindRoot
• Previous by thread: Re: Is it possible to impose a condition on an iterator
• Next by thread: Re: Is it possible to impose a condition on an iterator of the summation ?