Mathematica 9 is now available
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: Interaction of Sum/Plus and KroneckerDelta

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55261] Re: Interaction of Sum/Plus and KroneckerDelta
  • From: Maxim <ab_def at prontomail.com>
  • Date: Thu, 17 Mar 2005 03:31:27 -0500 (EST)
  • References: <d192un$ngm$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Wed, 16 Mar 2005 10:48:55 +0000 (UTC), Ofek Shilon <ofek at simbionix.com>  
wrote:

> I'm fighting Mathematica 5.1.0 to perform a (seemingly) elementary
> simplification, and Mathematica - so far - wins, so i thought i'd
> consult some veterans.
> Here's a simplified example of the problem.
>
> type:
> Sum[KroneckerDelta[i, j], {i, 1, 5}]
>
> and you get:
> KroneckerDelta[1, j] + KroneckerDelta[2, j] +
>   KroneckerDelta[3, j] + KroneckerDelta[4, j] + KroneckerDelta[5, j]
>
> which i want to simplify to 1.  The direct approach:
> Simplify[%, Assumptions -> {j  Integers, 0 < j < 3}]
>
> still gives:
> KroneckerDelta[1, j] + KroneckerDelta[2, j]
>
> Can Mathematica somehow automatically transform this to 1?
> modification of the original sum are welcome too, of course.
>
>   thanks for any ideas,
>
>     Ofek Shilon
>

You might want to try PiecewiseSum from
http://library.wolfram.com/infocenter/MathSource/5117/ . As mentioned in  
piecewise.nb, sometimes the best way is to evaluate a sum with symbolic  
limits and substitute numerical values later:

In[51]:=
s = PiecewiseSum[KroneckerDelta[i, j], {i, n}]

Out[51]=
If[1 <= j && j <= n, 1 - Ceiling[j] + Floor[j], 0]

In[52]:=
Refine[s /. n -> 5, Element[j, Integers] && 0 < j < 3]

Out[52]=
1

Or even

In[53]:=
Refine[s, Element[{j, n}, Integers] && 0 < j < n + 1]

Out[53]=
1

A more convoluted way would be to do

In[54]:=
Simplify[
   Refine[Sum[KroneckerDelta[i, j], {i, 5}], #]& /@
     Reduce[Element[j, Integers] && 0 < j < 3]]

Out[54]=
1

Finally, you can rewrite the sum as

In[55]:=
Sum[DiscreteDelta[i - j], {i, n}]

Out[55]=
UnitStep[-1 + j]*UnitStep[-j + n]

but notice that the result is correct only for integer j (PiecewiseSum  
gives a result identical to s).

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Re: Re: Surface Normal
  • Next by Date: Re: Re: Surface Normal
  • Previous by thread: Re: Re: Interaction of Sum/Plus and KroneckerDelta
  • Next by thread: Re: Interaction of Sum/Plus and KroneckerDelta