30
$\begingroup$

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?

$\endgroup$
  • 11
    $\begingroup$ it might be because wolfram alpha is calculating numerical value upto some accuracy, which is why you get nearly equal but different numbers $\endgroup$ – Piyush Divyanakar Jan 3 '18 at 3:27
  • 1
    $\begingroup$ Indeed, both numerical sum and the exact value yields the same numerical value in Mathematica 11. $\endgroup$ – Sangchul Lee Jan 3 '18 at 3:43
  • 7
    $\begingroup$ mathematica.stackexchange.com is probably the right place for this question. They even have a tag for bugs mathematica.stackexchange.com/questions/tagged/bugs $\endgroup$ – user66307 Jan 3 '18 at 11:53
  • $\begingroup$ I think debugging WolframAlpha should be outside the scope of this site. $\endgroup$ – Rahul Jan 3 '18 at 16:56
  • $\begingroup$ Does the first MathJax block (the one with $\sum$) need an additional pair of parentheses to include both $ln$ expressions? $\endgroup$ – shoover Jan 3 '18 at 22:05
53
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ How did you get the input to work in Mathematica? FullSimplify[Sum[Log[x^3+1]-Log[x^3-1],{x,2,Infinity}]] is just returning the sum unevaluated for me, both on my computer and also on Wolfram cloud. $\endgroup$ – numbermaniac Jan 4 '18 at 6:20
  • $\begingroup$ @numbermaniac I am using Version 10.4 on Mac OS. It evaluates fairly rapidly, in less than 5 seconds. $\endgroup$ – heropup Jan 4 '18 at 6:31
  • $\begingroup$ that's really strange, because I'm using 11.2 on macOS! I thought Mathematica was supposed to get better with each version :( $\endgroup$ – numbermaniac Jan 4 '18 at 6:34
3
$\begingroup$

When you split the product into two products, the first diverges to $\infty$ and the second goes to zero. This gives you the indeterminate $\infty-\infty$. All bets are off.

$\endgroup$
  • 1
    $\begingroup$ Perhaps it would be helpful to write down the partial products to make the infinities clear? $\endgroup$ – Michael Burr Jan 3 '18 at 3:43
  • 20
    $\begingroup$ Although OP's computation is not rigorous, the answer is correct. So the issue lies in the numerical algorithm behind WolframAlpha. $\endgroup$ – Sangchul Lee Jan 3 '18 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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