MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Oh, those complex values!!!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72206] Re: Oh, those complex values!!!
  • From: "David W. Cantrell" <DWCantrell at sigmaxi.net>
  • Date: Thu, 14 Dec 2006 05:49:31 -0500 (EST)
  • Organization: NewsReader.Com Subscriber
  • References: <elja1i$76b$1@smc.vnet.net>

aaronfude at gmail.com wrote:
> Integrating a real function, getting complex values again. How to get
> the correct answer here?

Sorry I don't have time for a detailed answer, but maybe this will help.

> How to systematically avoid this pitfall?
>
> f=x Log[a+b x+Sqrt[c+2d x+x^2]];
> t = Assuming[c>d^2&&a>0&&b>0,Integrate[f, x]];
> u=t/.a\[Rule]2/.b\[Rule]2/.c\[Rule]10/.d\[Rule]1;
>
> N[u/.x\[Rule]1-u/.x\[Rule]0]
> 9.50705\[InvisibleSpace]-29.7626 \[ImaginaryI]

I don't know what you did above, but surely it's not what you intended.
Note the parentheses below.

In[32]:= N[(u /. x -> 1) - (u /. x -> 0)]

Out[32]= 0.954442 + 6.28319 I

The real part is correct, and the imaginary part is exactly 2 Pi:

In[33]:= FullSimplify[Im[(u /. x -> 1) - (u /. x -> 0)]]

Out[33]= 2 Pi

which I suppose is due to some branch cut. Anyway, we don't want that, so
to get what you want from (u /. x -> 1) - (u /. x -> 0), you could either
just subtract 2 Pi I from it or take its real part:

In[34]:= FullSimplify[Re[(u /. x -> 1) - (u /. x -> 0)]]

Out[34]=
(1/4)*(1 + 4*Sqrt[3]*ArcCoth[Sqrt[3]] - 4*Log[3] + 4*Log[6] - 12*Log[1 +
Sqrt[10]] + 12*Log[2 + Sqrt[13]] + 2*Log[4 + Sqrt[13]] + 2*(2 + Sqrt[3])*
    Log[(18*(5 + 3*Sqrt[3]))/(9 - Sqrt[3] + 2*Sqrt[30])] +
   2*(-2 + Sqrt[3])*Log[(18*(-5 + 3*Sqrt[3]))/(9 + Sqrt[3] + 2*Sqrt[30])] +
   2*(2 + Sqrt[3])*Log[(1/18)*(7 - 4*Sqrt[3])*(9 - 2*Sqrt[3] + 2*Sqrt[39])]
   + 2*(-2 + Sqrt[3])*Log[(1/18)*(7 + 4*Sqrt[3])*(9 + 2*Sqrt[3] +
   2*Sqrt[39])] - 4*Sqrt[3]*Re[ArcTanh[2/Sqrt[3]]])

In[35]:= N[%]

Out[35]= 0.954442

David W. Cantrell

> NIntegrate[f/.a\[Rule]2/.b\[Rule]2/.c\[Rule]10/.d\[Rule]1, {x, 0, 1}]
> 0.954442
>
> Many thanks in advance!
>
> Aaron Fude


  • Prev by Date: WebMathematica problem
  • Next by Date: Re: FindRoot anomaly (example from Mathematica Tutorial)
  • Previous by thread: Re: Oh, those complex values!!!
  • Next by thread: it seems like InequalityPlot can only handle a color for the PlotStyle... nothing more complicated... (?)