Incorrect integration from article

Recently I came across an interesting article by Daniel Lichtblau, where the integral

Integrate[Abs[x - y]^n, {x, 0, 1}, {y, 0, 1}]


Piecewise[{2/((1 + n)*(2 + n)),Re[n] > -2 }}, Integrate[ Abs[x - y]^n, {x, 0, 1}, {y, 0, 1}, Assumptions -> Re[n] <= -2]]

(The same result is obtained in 12.2 and with RealAbs instead of Abs.) is presented.

As I understand it, the conditions  Re[n] > -1 and Re[n] <= -1 should be in the above. Here are my arguments. First, the expression 2/((1 + n)*(2 + n)) is negative for n < -1, n > -2, whereas the integrand is positive. Second, if n < 0, then we deal with an improper integral. Let us calculate its half by

Integrate[RealAbs[x - y]^(-n), {x, 0, 1}, {y, x + \[Epsilon], 1},
Assumptions -> \[Epsilon] > 0 && \[Epsilon] < 1/2]


ConditionalExpression[((-2 + n)^(-1) + \[Epsilon]^(1 - n))/ (-1 + n), Re[n] < 1]

Limit[%,\[Epsilon]->0,Direction->"FromAbove"]


ConditionalExpression[(2 - 3*n + n^2)^(-1), Re[n] < 1]

Is it a bug or am I missing something?

• This must be a bug indeed. The integral does not exist for R[n]<=-1. This can be seen by a substitution y -> x + w which turns the integral into something like $\int \int w^{n} \, \mathrm{d} w \, \mathrm{d} x$. Commented Mar 30, 2021 at 7:32
• Please report it to Wolfram Support and keep us posted on their answers! Commented Mar 30, 2021 at 12:26
• @MarcoB: "Thank You! We have received your message and will respond shortly." Commented Mar 30, 2021 at 14:00

Yes this must be a bug. Splitting the integral "by hand" gives the correct result:

Integrate[Integrate[(x - y)^n, {y, 0, x} ], {x, 0, 1}] +Integrate[Integrate[( y - x)^n, {x, 0, y} ], {y, 0, 1}]
(*ConditionalExpression[2/(2 + 3 n + n^2), Re[n] > -1]*)


Mathematica v12.2 evaluates the integral OP asked for only correct if GenerateConditions -> True or GenerateConditions -> False is included
Integrate[Abs[x - y]^n, {x, 0, 1}, {y, 0, 1},GenerateConditions -> True]

Case GenerateConditions -> Automatic gives the wrong result.
• Thank you for the workaround with GenerateConditions->True. Commented Mar 30, 2021 at 10:53