# Mathematica 9 and later behavior with derivative of a sum

Bug introduced in 9.0 or earlier and fixed in 11.0.0

In:

D[Sum[Sin[x],x],x]

D[Sum[f[x],x],x]

Out:

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

0


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

Mathematica 8 returns • 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

SetOptions[D, NonConstants -> {Sum}]

• 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