In these cases, I sometimes throw in seemingly extraneous assumptions:
Integrate[
Log[Abs[x - y]]/Sqrt[(α - x) (α - y)], {x,
0, α}, {y, 0, α},
Assumptions -> α > x > 0 && α > y > 0]
(* 4 α (-3 + Log[4] + Log[α]) *)
This is twice as fast (and risky):
Integrate[Log[Abs[x - y]]/Sqrt[(α - x) (α - y)],
{x, 0, α}, {y, 0, α},
Assumptions -> α > x > 0 && α > y > 0,
GenerateConditions -> False]
The difference between the OP's code and my first code is that while α > 0
implies α
is real, because inequalities imply the terms are real in Mathematica, {x, 0, α}
does not imply x
is real. The integration may take a complex path between two numbers that happen to be real, and Integrate
tries to deal with that. (GenerateConditions -> False
turns off some of the checking, and therefore it shortens the computation.) Now, I don't know the internal workings well enough to know what I've said is actually why the computation works (e.g., whether any component of the computation ever uses the assumption that x
is real under α > x > 0
and does not assume x
is real under the OP's assumption).
This is not a hard-and-fast rule, either: consider Integrate[1/x, {x, -1, I, 1}]
with and without the I
, and apparently, sometimes x
treated to be real.
I do know that this trick has worked for me before, and this is how I explain it to myself so that I might remember to use the trick when I get an unexpected complex result. It could be that some component of the calculation fails to add the condition that x
as real, but adding thus, Assumptions -> α > 0 && {x, y} \[Element] Reals
, fixes the problem (this works, too, but I like the more stringent version, just in case).
All I know, as I just said, is that this works sometimes and is worth trying.
Abs
that others have posted, and changing variables withx,y
-->alf-x,alf-y
converts this to something quite tame from the point of view of symbolic integration:In[186]:= 2*Integrate[Log[x - y]/Sqrt[x*y], {x, 0, alf}, {y, 0, x}, Assumptions -> alf > 0] // Simplify Out[186]= 4 alf (-3 + Log[4] + Log[alf])
$\endgroup$