[Math] Manual calculation doesn’t match Wolfram Alpha. Why

infinite-productsequences-and-series

Say I want to evaluate this sum:
$$\sum_{x=2}^\infty \ln(x^3+1)-\ln(x^3-1)$$
We can rewrite the sum as
$$\ln\left(\prod_{x=2}^\infty \frac{x^3+1}{x^3-1}\right)$$
We can split the product into two products:
$$\ln\left(\prod_{x=2}^\infty \frac{x+1}{x-1}\right)+\ln\left(\prod_{x=2}^\infty \frac{x^2-x+1}{x^2+x+1}\right)$$
These are both telescopic products! We can rewrite them as
$$\ln\left(\prod_{x=2}^\infty \frac{(x+2)-1}{x-1}\right)+\ln\left(\prod_{x=2}^\infty \frac{(x-1)^2+(x-1)+1}{x^2+x+1}\right)$$
Plugging in numbers makes this pattern more obvious;
$$\ln\left(\prod_{x=2}^\infty \frac{\color{green}{3}}{1}\frac {\color{red}{4}}{2} \frac{\color{blue}{5}}{\color{green}{3}} \frac{\color{bluedark}{6}}{\color{red}{4}} \right) +
\ln\left(\prod_{x=2}^\infty \frac{3}{\color{green}{7}} \frac{\color{green}{7}}{\color{red}{13}} \frac{\color{red}{13}}{\color{blue}{21}} \right)$$
Simplifying, we get that the sum is equal to
$$\ln(1/2)+\ln(3)=\ln\left(\frac 32 \right) \approx 0.405465108108164381978013115464349136571990423462494197614$$
However, when I put the sum in Wolfram Alpha directly, I get the following number:
$$0.4054588737136331726677370820628648457601892466568342890929$$

Why are these two numbers different? It's not a small difference either; it's on the 5th number after the decimal point! How can Wolfram make such an error?

Best Answer

In Mathematica, the input FullSimplify[Sum[Log[x^3+1]-Log[x^3-1],{x,2,Infinity}]] gives Log[3/2], exactly. In WolframAlpha, the issue is that when you request more digits of accuracy, it converts your input into the command NSum[Log[x^3 + 1] - Log[x^3 - 1], {x, 2, Infinity}, WorkingPrecision -> 104] which of course is insufficient working precision for the number of decimal digits that it displays due to the very slow convergence of the sum.

Somewhat ironically, if you enter Product[(x^3+1)/(x^3-1),{x,2,n}] into WolframAlpha, you get exact output: $$\frac{3n(n+1)}{2(n^2+n+1)},$$ which is correct, furthermore upon taking Limit[3n(n+1)/(2(n^2+n+1)), n -> Infinity], you get the correct answer $3/2$. So it isn't as if WolframAlpha cannot compute the original sum symbolically as Mathematica did. It just needs a little extra help, it seems.

Users of WolframAlpha don't always realize that although it is using the same underlying algorithms as Mathematica, it is not the same thing. There are things that one does that the other does not. Precise control of processing of input, for example, is something that the former does not do.


Update. I believe the above response is not entirely sufficient to explain the behavior of WolframAlpha. When I changed the summand to $$\log \left(1 + \frac{2}{x^3-1}\right),$$ WolframAlpha still gives the wrong result when more digits are requested, despite the fact that the generated code NSum[Log[1 + 2/(x^3 - 1)], {x, 2, Infinity}, WorkingPrecision -> 104] yields the correct result. So this points to an internal inconsistency with WolframAlpha that cannot be solely explained by the insufficient precision used in NSum.

To confirm, in Mathematica I input both variants with NSum, namely

NSum[Log[x^3 + 1] - Log[x^3 - 1], {x, 2, Infinity}, WorkingPrecision -> 104]

as well as

NSum[Log[1 + 2/(x^3 - 1)], {x, 2, Infinity}, WorkingPrecision -> 104]

The first input, as expected, generates a warning NIntegrate::ncvb. Also as expected, the second one does not. But if this is the case, then WolframAlpha should not still present the wrong result in the second case when more digits are requested, given that this is the exact code that it generated. When you open up the computable notebook (click the orange cloud) and evaluate the expression, you are basically running a cloud version of Mathematica. Doing this gets the right answer. So I suspect that there is some kind of bug in WolframAlpha that fails to present the correct output.

Related Question