Condition generation for complex integrals

• To: mathgroup at smc.vnet.net
• Subject: [mg48896] Condition generation for complex integrals
• From: ab_def at prontomail.com (Maxim)
• Date: Tue, 22 Jun 2004 05:31:59 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```When generating conditional results for integrals in the complex
plane, Mathematica often fails even on elementary functions:

In[1]:=
Integrate[1/z, {z, z1, z2}]

Out[1]=
If[Im[z2] == 0 && Im[z1] > 0 || Im[z2] == 0 && Im[z1] < 0 ||
Im[z2] > 0 && Im[z1] >= 0 || Im[z2] < 0 && Im[z1] <= 0 ||
Im[z1] > 0 && Re[z1] > (Im[z1]*Re[z2])/Im[z2] && Im[z2] < 0 ||
Im[z2] > 0 && Re[z1] > (Im[z1]*Re[z2])/Im[z2] && Im[z1] < 0,
-Log[z1] + Log[z2], <<1>>]

This is wrong for z1=-1-I and z2=-1. I believe that the version 5.0.1
gives a slightly different answer, splitting the above expression into
two If's, but the error still remains. And if the conditional output
is not strictly equivalent to the input expression, then it is worse
than incorrect -- it is misleading: the whole purpose of giving the
answer in the conditional form is to guarantee that the result will be
valid for all values of the parameters.

Now let's modify the integrand and try

Integrate[1/(z-I), {z, z1, z2}]

One would expect to get a result similar to the above, with everything
shifted by I. Instead, there is an extremely complicated condition in
the output, which, incidentally, is also incorrect if z1 or z2 lies on
the branch cut, for example, if z1=-2 and z2=2I. Mathematica expresses
the antiderivative of 1/(z-I) in terms of ArcTan and Log[1+z^2] to
avoid complex numbers in the answer, but in order to obtain an
antiderivative with a simple branch cut structure the most logical
choice of course would be to write the antiderivative as Log[z-I].

Next, we can evaluate the third argument of the resulting If
expression to find the value of the integral under different
assumptions, thus potentially obtaining the complete answer for all
possible values of the parameters:

In[2]:=
Evaluate //@ Integrate[Sqrt[z], {z, z1, z2}]

Out[2]=
(-z1 + z2)*
If[(Im[z1] - Im[z2])*((-Im[z2])*Re[z1] + Im[z1]*Re[z2]) > 0 ||
Im[z2]/(Im[z1] - Im[z2]) >= 0 ||
Im[z1]/(-Im[z1] + Im[z2]) >= 0,
(2*(z1 + Sqrt[z1]*Sqrt[z2] + z2))/(3*(Sqrt[z1] + Sqrt[z2])),
If[Im[z1/(z1 - z2)] != 0 || Re[z1/(z1 - z2)] < 0 ||
Im[z2/(-z1 + z2)] != 0 || Re[z2/(-z1 + z2)] < 0,
(2/3)*(z1/(Sqrt[z1] + Sqrt[z2]) + Sqrt[z2]), <<1>>]]

It is possible to go on applying Evaluate, but the second If is
already incorrect for z1=-1-I, z2=-1+I. It seems that Mathematica
primarily knows how to deal with such examples in certain
predetermined cases and has trouble with explicitly specified
conditions:

In[3]:=
Assuming[Re[z1] < 0 && Re[z2] < 0 && Im[z1] < 0 && Im[z2] > 0,
Integrate[Sqrt[z], {z, z1, z2}]]
Assuming[x1 < 0 && x2 < 0 && y1 < 0 && y2 > 0,
Integrate[Sqrt[z], {z, x1 + I*y1, x2 + I*y2}]]

Integrate::idiv: Integral of Sqrt[z] does not converge on {z1,z2}.

Out[3]=
Integrate[Sqrt[z], {z, z1, z2}]

Out[4]=
If[Im[(x1 + I*y1)/(x1 - x2 + I*(y1 - y2))] != 0 ||
Im[(x2 + I*y2)/(-x1 + x2 - I*y1 + I*y2)] != 0 ||
Re[(x1 + I*y1)/(x1 - x2 + I*(y1 - y2))] < 0 ||
Re[(x2 + I*y2)/(-x1 + x2 - I*y1 + I*y2)] < 0,
(2/3)*(-(x1 + I*y1)^(3/2) + (x2 + I*y2)^(3/2)), <<1>>]

The last two examples are essentially identical, but for the first one
Mathematica gives an irrelevant message, and the answer to the second
one is simply incorrect if we take x1=-1, y1=-1, x2=-1, y2=1. Thus so
far the usefulness of this feature of Mathematica 5.0 seems rather
limited.

Maxim Rytin
m.r at inbox.ru

```

• Prev by Date: Finding Recursive Pattern
• Next by Date: Re: Clear cell labels palette
• Previous by thread: Finding Recursive Pattern
• Next by thread: Re: Condition generation for complex integrals