Bug introduced in 9.0 or earlier and fixed in 11.0.0





1/2 Cos[1/2 (-1 - Pi + 2 x)] Csc[1/2]


Function f is undefined, but Mathematica 9 counts it as constant?

Mathematica 8 returns

Mathematica graphics

  • $\begingroup$ It's because you take derivative with respect to the local parameter of the sum. Sum itself doesn't depend on x. But in the case of Sin[x] it simplifies it first to the expression dependent of x. So it's not a bug. $\endgroup$
    – swish
    Dec 19, 2012 at 9:42
  • $\begingroup$ @swish so it is good if undefined function is counted as zero? $\endgroup$
    – Anixx
    Dec 19, 2012 at 9:49
  • $\begingroup$ Even more, the sum of a defined function and undefined one also gives zero: D[Sum[f[x] + Sin[x], x], x] -> 0 $\endgroup$
    – Anixx
    Dec 19, 2012 at 9:51
  • 3
    $\begingroup$ @Anixx If sum can be simplified then Sum[f[x],x] is the same as Sum[f[y],{y,0,x-1}]. But without specifying the limits it's not a function, because x is an index variable not an upper limit. $\endgroup$
    – swish
    Dec 19, 2012 at 10:12
  • 1
    $\begingroup$ @swish No matter what you expect it to mean, you will have to agree that if D[Sum[Sin[x],x],x] has a nonzero value, then D[Sum[f[x],x],x] cannot be zero in general, since we might have f==Sin. $\endgroup$
    – jVincent
    Dec 19, 2012 at 12:23

1 Answer 1


Probably this is just a bug. Especially since it "works" in 8. You could fix it by doing

SetOptions[D, NonConstants -> {Sum}]

first, or by putting this in your init.m file.

  • 1
    $\begingroup$ Sorry, but I wouldn't do that. Even in version 8 you would expect D[Sum,x] == 0 to be True, wouldn't you? $\endgroup$
    – Jens
    Dec 19, 2012 at 22:02
  • 1
    $\begingroup$ Well, we are supposed to use lower case letters for variables. Anyway, of course this is not a real fix, just a hack as a reminder that something is fishy in 9.0.0 (waiting for 9.0.1 anyway any day, aren't you, too?) $\endgroup$ Dec 19, 2012 at 22:38
  • $\begingroup$ Actually, I think I'm just waiting to get version 5.2 back one day... $\endgroup$
    – Jens
    Dec 19, 2012 at 22:42
  • $\begingroup$ Sum[f[x],x] gave an error there ... $\endgroup$ Dec 19, 2012 at 22:47
  • $\begingroup$ Well, are things better now? Anyway, I'm only kidding about the good old times... they weren't that good, either, I guess. $\endgroup$
    – Jens
    Dec 19, 2012 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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