# evaluation of the sum of KroneckerDelta

I need help. I need to know why the next code doesn't simplify in Mathematica 10 but it does in Mathematica 8. I need some similar in version 10. What can I do?

Assuming[0 <= m <= nn && m ∈ Integers,
FullSimplify[Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}]]]

• This doesn't simplify for me in either V8 or V10. However, in V10 Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}] automatically simplifies to f[m] UnitStep[-m + nn]. – march Oct 15 '15 at 21:38
• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. – bbgodfrey Oct 16 '15 at 0:33
• It does not simplify because nn stays there instead of n. Put n and it simplifies. – Alexei Boulbitch Aug 12 '16 at 9:50

Strangely, although

Assuming[0 <= m <= nn && m ∈ Integers,
FullSimplify[Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}]]]


does not simplify,

Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}]
(* f[m] UnitStep[-m + nn] *)
Assuming[0 <= m <= nn && m ∈ Integers, FullSimplify[%]]
(* f[m] *)


does. This constitutes a work-around, if needed. This two-step process was suggested in part by the comment by march.

An even simpler approach is to move the assumptions inside FullSimplify

FullSimplify[Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}],
0 <= m <= nn && m ∈ Integers]
(* f[m] *)


Dropping the assumptions entirely also works, although not so cleanly.

FullSimplify[Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}]]
(* Piecewise[{{f[m], m <= nn}}, 0] *)


As one might expect,

FullSimplify[Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}],
Assumptions -> 0 <= m <= nn && m ∈ Integers]


also simplifies properly. But,

$Assumptions = 0 <= m <= nn && m ∈ Integers; FullSimplify[Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}]]  does not. This may be a bug. Third Addendum - v10.3 No change in behavior for $Version
(* 10.3.0 for Microsoft Windows (64-bit) (October 9, 2015) *)


$Version (* 11.0.0 for Microsoft Windows (64-bit) (July 28, 2016) *)  the code Assuming[0 <= m <= nn && m ∈ Integers, FullSimplify[Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}]]] (* f[m] UnitStep[-m + nn] *)  now does simplify, although $Assumptions = 0 <= m <= nn && m ∈ Integers;