8
$\begingroup$

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}]]]
$\endgroup$
  • $\begingroup$ 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]. $\endgroup$ – march Oct 15 '15 at 21:38
  • $\begingroup$ 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. $\endgroup$ – bbgodfrey Oct 16 '15 at 0:33
  • $\begingroup$ It does not simplify because nn stays there instead of n. Put n and it simplifies. $\endgroup$ – Alexei Boulbitch Aug 12 '16 at 9:50
7
$\begingroup$

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.

Addendum

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] *)

Second Addendum

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) *)

Fourth Addendum - v11.0

With

$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;
FullSimplify[Sum[KroneckerDelta[m, n] f[n], {n, -Infinity, nn}]]

still does not.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.