7

I spent more than an hour trying to fix the formatting of the question below such that the Mathematica and Wolfram Language forum would accept it. I had no success, even though I am aware of threads such as this one.

I even tried to post the entire question inside <pre>...</pre> as below, so that someone with high reputation could modify it afterwards, but the error persisted.

I'd greatly appreciate it if someone helped me post the question.

Today I encountered a phenomenon in the free online version of WolframAlpha which looks to me like a bug. It would be great if someone could check whether the phenomenon also occurs when using Mathematica directly. I am not sure whether it might actually be normal behavior and I am just using  the software incorrectly.

I am considering the integral
$$
I(a):=\int_{\mathbb R}\int_{\mathbb R}\frac{|1-xy|^{a-1}}{((1+x^2)(1+y^2))^{(a+1)/2}}\,\mathrm{d}x\, \mathrm{d} y
$$
for $a\geq 1$. 

The free WolframAlpha is able to compute $I(a)$ for some $a$, for example, for $a=16$ one gets [this result][1], which claims that 
$$
I(16)=1.9141.
$$
If one replaces `abs(1-xy)^(a-1)` in the input by an artificial `((1-xy)^2)((a-1)/2)`, then one obtains a [different result][2], namely
$$
I(16)=1.99968.
$$
Now, one might think that the difference is simply explained by the fact that WolframAlpha cancels the powers and in reality computes the integral $I(a)$ with `abs(1-xy)^(a-1)` replaced by `(1-xy)^(a-1)` but this is not the case: For the latter integral one gets a third, [different value][3].


What strikes me is that **the correct result for $I(16)$ seems to be the one where  
`((1-xy)^2)((a-1)/2)` is used**, i.e., $I(16)=1.99968$.

Indeed, using basic Lie theoretic tools one can prove that
$$
I(a)=\frac{1}{4}\int_{0}^{2\pi}\int_{0}^{2\pi}|\cos(x-y)|^{a-1}\,\mathrm{d}x\, \mathrm{d} y,
$$
and WolframAlpha computes the value $I(16)=1.99968$ for the latter integral regardless of whether one writes `abs(cos(x-y))^(a-1)` or `(cos(x-y)^2)^((a-1)/2)` in the input. See [here][4] and [here][5].

**Is this a bug?**

The value $a=16$ is not important here, I just picked a value where WolframAlpha actually computes a result both with `abs(1-xy)^(a-1)` 
and `((1-xy)^2)((a-1)/2)`. 
Whenever that is the case for an even value of $a$, the phenomenon occurs.

When $a$ is odd, so that the absolute value does not matter, WolframAlpha always computes the same value of $I(a)$ in all variants of the input.

  [1]: https://www.wolframalpha.com/input/?i=integrate%20%20%28%281%2Bx%5E2%29%281%2By%5E2%29%29%5E%28-%2816%2B1%29%2F2%29abs%281-xy%29%5E%2816-1%29%20dx%20dy%20from%20x%3D-infty%20to%20infty%2C%20y%3D-infty%20to%20infty
  [2]: https://www.wolframalpha.com/input/?i=integrate%20%20%28%281%2Bx%5E2%29%281%2By%5E2%29%29%5E%28-%2816%2B1%29%2F2%29%28%281-xy%29%5E2%29%5E%28%2816-1%29%2F2%29%20dx%20dy%20from%20x%3D-infty%20to%20infty%2C%20y%3D-infty%20to%20infty
  [3]: https://www.wolframalpha.com/input/?i=integrate%20%20%28%281%2Bx%5E2%29%281%2By%5E2%29%29%5E%28-%2816%2B1%29%2F2%29%281-xy%29%5E%2816-1%29%20dx%20dy%20from%20x%3D-infty%20to%20infty%2C%20y%3D-infty%20to%20infty
  [4]: https://www.wolframalpha.com/input/?i=integrate%201%2F4%20%7Ccos%28x-y%29%7C%5E%2816-1%29%20dx%20dy%20from%20x%3D0%20to%202pi%2C%20y%3D0%20to%202pi
  [5]: https://www.wolframalpha.com/input/?i=integrate%201%2F4%20%28cos%28x-y%29%5E2%29%5E%28%2816-1%29%2F2%29%20dx%20dy%20from%20x%3D0%20to%202pi%2C%20y%3D0%20to%202pi
  [6]: https://www.wolframalpha.com/input/?i=integrate%201%2F%28pi%29%5E2%20%28%281%2Bx%5E2%29%281%2By%5E2%29%29%5E%28%28-28%29%2F2-1%2F2%29abs%281-xy%29%5E%28-%28-28%29-1%29%20dx%20dy%20from%20x%3D-infty%20to%20infty%2C%20y%3D-infty%20to%20infty
  [7]: https://www.wolframalpha.com/input/?i=integrate%20%20%28%281%2Bx%5E2%29%281%2By%5E2%29%29%5E%28-%2828%2B1%29%2F2%29%28%281-xy%29%5E2%29%5E%28%2828-1%29%2F2%29%20dx%20dy%20from%20x%3D-infty%20to%20infty%2C%20y%3D-infty%20to%20infty
  [8]: https://www.wolframalpha.com/input/?i=integrate%201%2F4%20abs%28cos%28x-y%29%29%5E%2828-1%29%20dx%20dy%20from%20x%3D0%20to%202pi%2C%20y%3D0%20to%202pi
  [9]: https://www.wolframalpha.com/input/?i=integrate%201%2F4%20%28cos%28x-y%29%5E2%29%5E%28%2828-1%29%2F2%29%20dx%20dy%20from%20x%3D0%20to%202pi%2C%20y%3D0%20to%202pi
6
  • 1
    I suggest you check out: meta.stackexchange.com/questions/22186/… Here you seem to of formatted the whole post as code and not just the code, that would account for the error.
    – Mark Kirby
    Jun 18, 2021 at 10:59
  • 2
    @MarkKirby: The code block apperance of my question is just due to the fact that I put it inside '<pre>...</pre>' here. Of course, when originally trying to post it, I did not use those tags.
    – B K
    Jun 18, 2021 at 11:02
  • 3
    It looks to me that the newline before and after the double dollar signs $$ is the problem; simply place the equation between the dollar signs - $$MathJax Equation$$. - See, looks the same when rendered.
    – Rob
    Jun 18, 2021 at 11:36
  • 2
    @Rob: thank you very much, that was indeed the solution!
    – B K
    Jun 18, 2021 at 11:53
  • BK, We'd (I'd) appreciate it if you wrote your own answer.
    – Rob
    Jun 18, 2021 at 12:00
  • Confirmed. This is a bug in the Stack Exchange filter. The bug has been fixed at Stack Overflow, but not at Software Engineering, where anyone can still reproduce the bug. Just press Review your question (with your Markdown of course), and you'll see the error.
    – Henke
    Mar 4 at 18:38

1 Answer 1

5

The problem is solved: The error was caused by the newline before and after $$, as pointed out by Rob in the comments.

In other words, changing

$$
I(16)=1.99968.
$$

to

$$I(16)=1.99968.$$

throughout my post fixed the error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .