# Well-defined symbolic integral leading to ConditionalExpression

I would like to determine a closed-form expression for the following symbolic integral

$$\int_{-1/2}^{1/2} \!\!\!\! \mathrm{d} x \int_{-1/2}^{1/2} \!\!\!\! \mathrm{d} y \, \frac{1 + b x + c y}{1 + e x + f y + i \eta} \, ,$$

where the coefficients appearing in this expression are such that

$$\begin{cases} \displaystyle b,c,e,f \in \mathbb{R} \, , \\ \displaystyle \eta \in \mathbb{R}\, , \, \eta \neq 0 \, . \end{cases}$$

As a consequence, this integral is always well-defined since its denominator is never equal to 0. To compute this integral in Mathematica, I used the instruction :

int = Integrate[(1 + b x + c y)/(1 + e x + f y + I \[Eta]), {x, -1/2,1/2}, {y, -1/2, 1/2}, Assumptions -> {b \[Element] Reals, c \[Element] Reals, e \[Element] Reals, f \[Element] Reals, \[Eta] \[Element] Reals, \[Eta] != 0}]


After a quite long calculation (260s) on my computer with Mathematica 10.0.2, I obtained a result of the form

int = ConditionalExpression[......,(f<-2 && (2+f<e<0 || (e>0 && 2+e+f<0))) || (-2<f<0 && ((2+e+f>0 && e<0) || 0<e<2+f)) || (0<f<2 && (-2+f<e<0 || (e>0 && e+f<2))) || (f>2 && ((e+f>2 && e<0) || 0<e<-2+f))]]


Why do I obtain a result with a ConditionalExpression, while my integral should always be correctly defined ? How should I proceed to convince Integrate that this integral is always well-defined ?

I noticed that the result inside the ConditionalExpression involves terms of the form ArcTan[(2 \[Eta])/(-2+e+f)], which partially explain the constraints obtained.

Another issue is that the result inside the ConditionalExpression also involves complex logarithmic terms of the form Log[2-e-f+2 I \[Eta]] . I know that the complex logarithm has a branch-cut so that the result may not be robust when being evaluated.

Would it also be possible to obtain a result that would not involve expression with branch-cuts, so that the results would always be straightforwardly well defined ?

You can gain insight by evaluating and then simplifying the indefinite integrals.

Integrate[(1 + b x + c y)/(1 + e x + f y + I η), y, x, Assumptions -> {x ∈ Reals,
y ∈ Reals, b ∈ Reals, c ∈ Reals, e ∈ Reals,f ∈ Reals, η ∈ Reals, η != 0}];
ans = Collect[%, {ArcTan[η/(1 + e x + f y)], Log[1 + e^2 x^2 + 2 f y + f^2 y^2 +
2 e (x + f x y) + η^2]}, Simplify]


The result is free of conditions but contains an ArcTan function, which is multi-valued, changing sign at 1 + e x + f y == 0.

(* ((I/2)*(f*(b*(e^2*x^2 - (1 + f*y + I*η)^2) + 2*e*(1 + e*x + I*η)) -
c*e*(1 + e*x + I*η)^2)*ArcTan[η/(1 + e*x + f*y)])/(e^2*f^2) +
(y*(f*(-4*e + b*(2 + 2*e*x + f*y + (2*I)*η)) +
c*e*(2 + 2*e*x - f*y + (2*I)*η) + 2*e*f*(2 + c*y)*
Log[1 + e*x + f*y + I*η]))/(4*e^2*f) +
((f*(b*(e^2*x^2 - (1 + f*y + I*η)^2) + 2*e*(1 + e*x + I*η)) -
c*e*(1 + e*x + I*η)^2)*Log[1 + e^2*x^2 + 2*f*y + f^2*y^2 +
2*e*(x + f*x*y) + η^2])/(4*e^2*f^2) *)


A sample plot of Im[ans] is given by

Plot3D[Evaluate[Im[ans] /. {b -> 3, c -> 3, e -> -3, f -> 3, η -> .1}],
{x, -1/2, 1/2}, {y, -1/2, 1/2}, PlotRange -> All, PlotPoints -> 50,
AxesLabel -> {x, y, "Im[ans]"}, ImageSize -> 500, Exclusions -> None]


However, obviously the integral itself is not discontinuous, the discontinuity in ans arising from the branch cut in ArcTan. But, we are free to choose a different branch that eliminates this spurious discontinuity. Doing so can be accomplished by defining

myarctan[z_] := Piecewise[{{ArcTan[z], z > 0}, {Pi + ArcTan[z], z < 0}}, Pi/2];


and making the substitution

ans = ans /. ArcTan -> myarctan


The redefined ans is continuous.

Alternative to myarctan

The substitution

ans = ans /. ArcTan[z_] :> Pi/2 - ArcTan[1/z]


has the same effect as ans = ans /. ArcTan -> myarctan but does not require definition of a new function. This alternative is based on equations 4.236 and 4.239 of the digital revised version of Handbook of Mathematical Functions.

In answer to the additional question posed in a Comment below, the corresponding definite integral is given by

(ans /. {x -> 1/2, y -> 1/2}) - (ans /. {x -> 1/2, y -> -1/2}) -
(ans /. {x -> -1/2, y -> 1/2}) + (ans /. {x -> -1/2, y -> -1/2})

• Thank you for your answer. It seems indeed, that considering the indefinite integral allowed to obtain simple expressions. Once you have determined the indefinite integral, how would you proceed to determine the value of the integral for $x \in \{ -1/2, 1/2\}$ and $y \in \{ -1/2, 1/2 \}$ ? – jibe Mar 27 '15 at 14:36
• @jibe I have provided an updated answer to the question in your Comment as an addendum to my earlier Answer. Basically, you must take account of the discontinuity at 1 + e x + f y == 0. – bbgodfrey Mar 27 '15 at 17:12
• @jibe I eliminated the discontinuity in my most current update, eliminating the need to worry about conditions. – bbgodfrey Mar 27 '15 at 19:23
• In your updated answer, you indeed manage to get rid of the discontinuity present in Im[ans]. However, you only checked visually by looking at the case {b -> 3, c -> 3, e -> -3, f -> 3, η -> .1}. How can we be sure that for any other values of e and f there will be no discontinuities ? How general is your modifcation of ArcTan ? (I was worried by the presence of Log[1 + e*x + f*y + I*η] for other discontinuities, but because η != 0, this function will never cross the branch-cut, so that the only issue is indeed the ArcTan.) – jibe Mar 28 '15 at 10:24
• @jibe As you noted in your last Comment, the Log terms are continuous for real x and y. That leaves the ArcTan term, which has a discontinuity only at 1 + e x + f y == 0, and myarctan fixes that. So, I am confident that there are no other discontinuities. But, just to be sure, I looked at several other representative sets of e and f and found none. – bbgodfrey Mar 28 '15 at 12:48

One way to approach this is to look for the source of the problem. In this case, the outer integral (on y) is irrelevant to the problem, because even the simpler integral

int = Integrate[(1 + b x)/(1 + e x + I η), {x, -1/2, 1/2},
Assumptions -> {b ∈ Reals, c ∈ Reals, e ∈ Reals, η ∈ Reals, η != 0}]


gives a conditional expression. But now the answer is smaller and easier to see. The answer contains the term

Log[2 - e + 2 I η]


and the condition is that -2 < e < 2. So what is happening is that you are encountering different branches of the Log function.

You can evaluate this for different branches. For instance, instead of the assumption e ∈ Reals, use e<-2, e>2 or e==0. These all return (nonconditional) answers. The last one is even simple:

1/(1 + I η)


Hopefully these answers can feed back into the original problem with the double integral.

• Indeed, looking at the simpler case of only one integral is a good way to look at this problem. Once you have obtained this result with a ConditionalExpression, how would you evaluate it for $|e < 2|$, $|e| > 0$ or even $e = 0$ ? – jibe Mar 27 '15 at 14:42
• @jibe -- see update – bill s Mar 27 '15 at 14:54
• Thank you, I believe this approach should allow me to obtain the expressions needed. The only remaining task for me is to correctly partition the $(e,f)$ space so as to be able to handle all cases. In case of trouble with the general case, I will come back to you. – jibe Mar 27 '15 at 15:10