Out of curiousity, please consider following expression:
Sum[(-1)^(n + 1)/n, {n, 1, 100000}]
When evaluated using Wolfram Alpha:
Result: 0.693142 - 1.3494*10^-16 I
, complex number
When evaluated using Mathematica v.10.2 (to 6 decimal places):
Result: 0.693142
, rational number
Why Wolfram Alpha evaluates expression stated above to a complex number?
a^b
asExp[Log[a]*b]
. That would give complex numbers in intermediate calculations, where the imaginary part doesn't perfectly cancel out due to numerical inaccuracy. Compare:Sum[Exp[Log[(-1.)]*(n + 1)]/n, {n, 1, 100000}]
in Mathematica gives a complex result, too (though not the same...) $\endgroup$a^b
it would be rather inefficient although generic at the same time. It's rather curious to say the least. $\endgroup$Sum[(-1)^(n + 1)/n, {n, 1, m}] /. m -> 100000.
or(Sum[(-1)^(n + 1)/n, {n, 1, m}] /. m -> 100000) // N
orNSum[(-1)^(n + 1)/n, {n, 1, 1000000}] // Chop
$\endgroup$