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.
- References:
- how to make conditional summation
- From: "Xiao Jun Jun" <xiaoxun@gmail.com>
- how to make conditional summation