MathGroup Archive 2005

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

Search the Archive

Re: how to make conditional summation

Three suggestions:

1) Never capitalize the names of your own variables. N is a built-in function, so it's a bad idea to use it this way.

2) Tell us your question. This is perfectly well defined, for instance:


1+2 Cos[1]+2 Cos[2]+2 Cos[3]+2 Cos[4]+2 Cos[5]

and 5 isn't zero, so... what's the problem?

3) If you meant "Sum[f[m],{m,-N,N}] with m != 0", one of these should do it:

Sum[f@m, {m, -n, n}] - f[0]

Sum[f@m, {m, -n, -1}] + Sum[f@m, {m, 1, n}]


Sum[Boole[n != 0] f@m, {m, -n, n}]

Boole is in the kernel in version 5, but before that it was in the Calculus`Integration` package.


Sum[If[m != 0, f@m, 0], {m, -n, n}]


On Tue, 29 Mar 2005 03:42:29 -0500 (EST), Xiao Jun Jun <xiaoxun at> wrote:

> Hi, All,
> Say, Sum[f[m],{m,-N,N}] with N != 0
> Any suggestions?
> Regards.
> Xun

DrBob at

  • Prev by Date: Re : Position function
  • Next by Date: Re: Varying colors in Plot3D according to Height
  • Previous by thread: Re: how to make conditional summation
  • Next by thread: Re: how to make conditional summation