Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11634 > unrolled thread

Integrate yields complex results

Started bymatteo.poggi.fi@gmail.com
First post2012-09-06 08:18 +0000
Last post2012-09-08 07:09 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Integrate yields complex results matteo.poggi.fi@gmail.com - 2012-09-06 08:18 +0000
    Re: Integrate yields complex results "Dr. Wolfgang Hintze" <weh@snafu.de> - 2012-09-08 07:09 +0000

#11634 — Integrate yields complex results

Frommatteo.poggi.fi@gmail.com
Date2012-09-06 08:18 +0000
SubjectIntegrate yields complex results
Message-ID<k29m8f$ab8$1@smc.vnet.net>
Hi, using Mathematica 8.0 I computed this expression:

Integrate[((1 + y^2) (1 + x^2 + y^2)^(1/2))^(-1), y]

obtaining ugly complex Logarithms which cannot be simplified even with ExpToTrig. The correct real result is given by Mathematica 5.2 and is

ArcTan[xy/((x+^2+y^2+1)^(1/2))]

How is possible to obtain this result with 8.0 version.
I even tried to calculate Real and Imaginary part, but 8.0 refuses to do that. Please help me. I need to use Mathematica for research.

[toc] | [next] | [standalone]


#11662

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2012-09-08 07:09 +0000
Message-ID<k2eqvb$k8j$1@smc.vnet.net>
In reply to#11634
On 6 Sep., 10:19, matteo.poggi...@gmail.com wrote:
> Hi, using Mathematica 8.0 I computed this expression:
>
> Integrate[((1 + y^2) (1 + x^2 + y^2)^(1/2))^(-1), y]
>
> obtaining ugly complex Logarithms which cannot be simplified even with ExpToTrig. The correct real result is given by Mathematica 5.2 and is
>
> ArcTan[xy/((x+^2+y^2+1)^(1/2))]
>
> How is possible to obtain this result with 8.0 version.
> I even tried to calculate Real and Imaginary part, but 8.0 refuses to do that. Please help me. I need to use Mathematica for research.

Your integral is

In[1]:= f = Integrate[((1 + y^2)*(1 + x^2 + y^2)^(1/2))^(-1), y]

Out[1]= (I*
    Log[(4*I*(1 + x^2 + I*y))/(x*(-I + y)) + (4*I*
         Sqrt[1 + x^2 + y^2])/(-I + y)])/(2*x) -
   (I*Log[-((4*I*(1 + x^2 - I*y))/(x*(I + y))) - (4*I*
         Sqrt[1 + x^2 + y^2])/(I + y)])/(2*x)

Getting more and more annoyed, I didn't succeed to find the
simplification until I eventually remembered the option
TargetFunctions which used to be useful in telling ComplexExpand more
precisely what to do.
Thus

In[2]:= f1 =
 FullSimplify[
  ComplexExpand[f, TargetFunctions -> {Re, Im}], {x > 0, y > 0}]

Out[2]= (-Pi + ArcTan[(x*y)/Sqrt[1 + x^2 + y^2]])/x

This is in fact your integral which as an indefinite integral
correctly provides an antiderivative.
Indeed, the first derivative with respect to y is

In[3]:= Simplify[D[f1, y]]

Out[3]= 1/((1 + y^2)*Sqrt[1 + x^2 + y^2])

which gives back the integrand.

Now, let's have a look at the definite integral between 0 and t:

In[1]:= Timing[
 g = Integrate[((1 + y^2)*(1 + x^2 + y^2)^(1/2))^(-1), {y, 0, t},
   Assumptions -> {Element[{x, t}, Reals], t > 0}]]

Out[1]= {15.709, (I*(2*I*ArcCot[(t*x)/Sqrt[1 + t^2 + x^2]] +
      Log[-((2*I)/x)] - Log[(2*I)/x]))/(2*x)}

This takes some time (15.7 seconds) and gives again a complex result
despite the Assumptions.
(For comparision, version 5.2 needs just 1.3 seconds for the final
real result).
Simplifying it similarly gives

In[2]:= Timing[
 g1 = FullSimplify[
   ComplexExpand[g, TargetFunctions -> {Re, Im}], {x > 0, y > 0}]]

Out[2]= {0.1709999999999976, (Pi -
    2*ArcCot[(t*x)/Sqrt[1 + t^2 + x^2]])/(2*x)}

This result is okay but more complicated than necessary. I didn't have
the nerve so late at night to simplify it in version 8.

Now the definite integral can of course be calculated by hand by
taking the difference of f1 calculated earlier:

In[319]:= fi = Simplify[(f1 /. y -> t) - (f1 /. y -> 0)]

Out[319]= ArcTan[(t*x)/Sqrt[1 + t^2 + x^2]]/x

That's the result we liked to get immediately.

Summarizing, I would refuse to say that version 8 is really very
helpful in this caculation. It is the other way round: as a user you
must be generously and time-consumingly helpful towards version 8 to
obtain a satisfactory result.

If I had a wish free from Wolfram I would like to have the function
Integrate improved as soon as possible restoring the power of version
5.2.

Best regards,
Wolfgang

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web