Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Bug introduced in 9.0 or earlier and persisting through 10.3.0 or later





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

share|improve this question
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. – swish Dec 19 '12 at 9:42
@swish so it is good if undefined function is counted as zero? – Anixx Dec 19 '12 at 9:49
Even more, the sum of a defined function and undefined one also gives zero: D[Sum[f[x] + Sin[x], x], x] -> 0 – Anixx Dec 19 '12 at 9:51
@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. – swish Dec 19 '12 at 10:12
@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. – jVincent Dec 19 '12 at 12:23
up vote 3 down vote accepted

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.

share|improve this answer
Sorry, but I wouldn't do that. Even in version 8 you would expect D[Sum,x] == 0 to be True, wouldn't you? – Jens Dec 19 '12 at 22:02
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?) – Rolf Mertig Dec 19 '12 at 22:38
Actually, I think I'm just waiting to get version 5.2 back one day... – Jens Dec 19 '12 at 22:42
Sum[f[x],x] gave an error there ... – Rolf Mertig Dec 19 '12 at 22:47
Well, are things better now? Anyway, I'm only kidding about the good old times... they weren't that good, either, I guess. – Jens Dec 19 '12 at 22:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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