Re: Why does this lead to an answer with complex numbers?

*To*: mathgroup at smc.vnet.net*Subject*: [mg71497] Re: Why does this lead to an answer with complex numbers?*From*: "David W. Cantrell" <DWCantrell at sigmaxi.net>*Date*: Mon, 20 Nov 2006 18:12:00 -0500 (EST)*Organization*: NewsReader.Com Subscriber*References*: <ejosmm$n3k$1@smc.vnet.net> <ejrmr9$97b$1@smc.vnet.net> <ejs3fv$9ii$1@smc.vnet.net>

Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com> wrote: > aaronfude at gmail.com wrote: > > Hi, > > > > Thanks for all the answers. They were all very useful, even though I > > have done my best to confuse everyone by leaving a beta in there which > > had nothing to do with the problem. > > > > So I understand that the answer may be complex and the complex part is > > constant which is in a certain sense valid for a indefinite integral. > > But I very much need a real answer and I still can't quite extract. > > Consider the following: > > > > \!\(\(\(\ \)\(Assuming[x > 0 && A > 0 && B > 0 && \ B < 1, \ > > FullSimplify[Integrate[Log[\@\(A^2 + x\^2\) - B*x\ ], \ x]]]\)\)\) > > > > The answer that I get is correct, but not very useful since it is > > appears complex and I could find a way to determine the real part. Do > > you have any suggestions? For mine, see the end of this post. > Hi Aaron, > > What version of Mathematica do you use? With Mathematica 5.2 I do not > get any complex numbers for your integral. Yes, you do. The mere fact that /I/ does not appear in the expression does not mean that it is necessarily real. While there may be some special values of A, B, and x which cause Out[1] to be real, it is generally complex. > In[1]:= > Assuming[x > 0 && A > 0 && B > 0 && B < 1, > FullSimplify[Integrate[Log[Sqrt[A^2 + x^2] - B*x], x]]] > > Out[1]= > 1 2 2 2 > --------------- (2 Sqrt[-1 + B ] x (-1 + Log[-B x + Sqrt[A + x ]]) + > 2 > 2 Sqrt[-1 + B ] > > 2 > Sqrt[-1 + B ] x > A (2 ArcTanh[---------------] - 4 Log[A] - 4 Log[B] + > A > > 2 2 2 > 4 (-1 + B) (1 + B) (A Sqrt[-1 + B ] - x + B Sqrt[A + x ]) > > Log[-(----------------------------------------------------------)] + > 2 2 > A Sqrt[-1 + B ] + (-1 + B ) x > > 2 2 2 2 > (-1 + B ) (A Sqrt[-1 + B ] + x + B Sqrt[A + x ]) > Log[-------------------------------------------------])) > 2 2 > A Sqrt[-1 + B ] + x - B x > > In[2]:= > FreeQ[%, I] > > Out[2]= > True [snip] My suggestion is that you get an antiderivative using some work done by hand. My result is x*(Log[Sqrt[A^2 + x^2] - B*x] - 1) + A/Sqrt[1 - B^2]*(ArcCot[A*B/Sqrt[(1 - B^2)*(A^2 + x^2)]] + ArcTan[Sqrt[1 - B^2]*x/A]) the correctness of which is easily checked using Mathematica: In[1]:= FullSimplify[D[x*(Log[Sqrt[A^2 + x^2] - B*x] - 1) + A/Sqrt[1 - B^2]*(ArcCot[A*B/Sqrt[(1 - B^2)*(A^2 + x^2)]] + ArcTan[Sqrt[1 - B^2]*x/A]), x], x > 0 && A > 0 && 0 < B < 1] Out[1]= Log[(-B)*x + Sqrt[A^2 + x^2]] Note that my antiderivative is not only real, but all its subexpressions are real. Can anyone get Mathematica to find such an antiderivative directly? David

**Follow-Ups**:**Re: Re: Why does this lead to an answer with complex numbers?***From:*Andrzej Kozlowski <akoz@mimuw.edu.pl>