MathGroup Archive 2005

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

Search the Archive

Re: how to make conditional summation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55577] Re: [mg55545] how to make conditional summation
  • From: DrBob <drbob at bigfoot.com>
  • Date: Wed, 30 Mar 2005 03:21:14 -0500 (EST)
  • References: <200503290842.DAA07247@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

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:

Sum[Cos@m,{m,-5,5}]

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}]

or

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.

or...

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

Bobby

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

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



-- 
DrBob at bigfoot.com


  • 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