Bug introduced in 8.0 or earlier and persisting through 11.2.0 or later. Fixed in 13.2.0 or earlier.
I am using Mathematica 8.0.1 and discovered that this integral:
a = Sum[Integrate[1/n^s*2^(s - 1), s], {n, 1, 6}]
$$\frac{s}{2}-\frac{2^{-s-1}}{\log (2)}+\frac{2^{s-1}}{\log (2)}+\frac{2^{s-1} 3^{-s}}{\log (2)-\log (3)}-\frac{3^{-s}}{2 \log (3)}+\frac{2^{s-1} 5^{-s}}{\log (2)-\log (5)}$$
and this integral:
b = Integrate[Sum[1/n^s*2^(s - 1), {n, 1, 6}], s]
$$\frac{1}{2} \left(\frac{\left(\frac{2}{3}\right)^s}{\log (48)}-\frac{2^{-s}}{\log (2)}+\frac{2^s}{\log (144)}+\frac{3^{-s}}{\log \left(\frac{10}{3}\right)}+\frac{\left(\frac{2}{5}\right)^s}{\log \left(\frac{288}{5}\right)}\right)$$
give symbolically different results although they according to the sum rule in integration should be the same.
The sum rule has been discussed earlier on this forum but I could not find a question that would answer this particular example.
The same difference is seen in this numeric test:
(*Start*)
Clear[a, b, s, n];
a = Sum[Integrate[1/n^s*2^(s - 1), s], {n, 1, 6}]
b = Integrate[Sum[1/n^s*2^(s - 1), {n, 1, 6}], s]
s = 2;
Print["The following difference should be zero:"]
N[a - b]
(*End*)
where the numeric value 2.67373 from the output, should be 0.
Is this a bug / unexpected behaviour in other versions of Mathematica too?
I have been in contact with the Technical Support at Wolfram Research Inc., and they agree that this difference does seem incorrect.
Edit this question if you like.
Edit 11.2.2018:
Compare this integral:
a = Integrate[1/1^s*2^(s - 1), s] + Integrate[1/2^s*2^(s - 1), s] + Integrate[1/3^s*2^(s - 1), s]
$$\frac{s}{2}+\frac{2^{s-1}}{\log (2)}+\frac{2^{s-1} 3^{-s}}{\log (2)-\log (3)}$$
to this integral:
b = Integrate[1/1^s*2^(s - 1) + 1/2^s*2^(s - 1) + 1/3^s*2^(s - 1), s]
$$\frac{1}{2} \left(s-\frac{\left(\frac{2}{3}\right)^s}{\log \left(\frac{3}{2}\right)}+\frac{2^s}{\log (4)}\right)$$
The latter is wrong.
Integrate[1/n^s*2^(s - 1), s]
. It is easy to show this much is correct. Also easy to see sum and integral need not commute in this circumstance. $\endgroup$Integrate[1/1^s*2^(s - 1) + 1/2^s*2^(s - 1) + 1/3^s*2^(s - 1) + 1/4^s*2^(s - 1) + 1/5^s*2^(s - 1) + 1/6^s*2^(s - 1), s]
$\endgroup$Clear[a, b, s]; a = Integrate[1/1^s*2^(s - 1) + 1/2^s*2^(s - 1) + 1/3^s*2^(s - 1), s]; b = Integrate[1/1^s*2^(s - 1), s] + Integrate[1/2^s*2^(s - 1), s] + Integrate[1/3^s*2^(s - 1), s]; s = 2; N[a - b, 30]
$\endgroup$