Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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: [mg55575] Re: [mg55545] how to make conditional summation
  • From: Igor Antonio <igora at wolf-ram.com>
  • Date: Wed, 30 Mar 2005 03:21:10 -0500 (EST)
  • Organization: Wolfram Research, Inc.
  • References: <200503290842.DAA07247@smc.vnet.net>
  • Reply-to: igora at wolf-ram.com
  • Sender: owner-wri-mathgroup at wolfram.com

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

Xun, the easiest way is to use Conditions on the input.  In this case, 
the condition code is:

        /; N != 0


In[1]:= func[N_ /; N != 0] := Sum[f[m], {m, -N, N}]

In[2]:= func[2]

Out[2]= f[-2] + f[-1] + f[0] + f[1] + f[2]

In[5]:= func[0]

Out[5]= func[0]


-- 


Igor Antonio
Wolfram Research, Inc.
http://www.wolfram.com

To email me personally, remove the dash.


  • Prev by Date: Re: Position function
  • Next by Date: Re: Position function
  • Previous by thread: how to make conditional summation
  • Next by thread: Re: how to make conditional summation