Re: Keeping it real

*To*: mathgroup at smc.vnet.net*Subject*: [mg120286] Re: Keeping it real*From*: Sebastian Hofer <sebhofer at gmail.com>*Date*: Sat, 16 Jul 2011 05:43:37 -0400 (EDT)*Reply-to*: comp.soft-sys.math.mathematica at googlegroups.com

On Friday, July 15, 2011 3:23:35 AM UTC+2, amannuc wrote: > I am facing perhaps the "age-old" question of limiting the indefinite > integrals that Mathematica returns. In particular, I am trying to > avoid complex numbers. I have tried using "Assumptions" in the Integrate > command to no avail. > > The specific integral is: > > SetAttributes[{c0, d0}, {Constant}] (* Probably redundant. See Block > function *) > Simplify[Block[{a, c0, d0}, > 2.0 * a * > Integrate[ > ((-d0/z^2)/(c0 + d0/z))/Sqrt[-a^2 + z^2 (c0 + d0/z)^2], > z, > Assumptions -> {z \[Element] Reals, a \[Element] Reals, > c0 \[Element] Reals, d0 \[Element] Reals}]]] > > > > Admirably, Mathematica returns an answer, although with complex > numbers. I verified the answer is correct by taking its derivative. > The returned answer is: > (0. - 2. I) Log[-((2 d0 (-I a + Sqrt[-a^2 + (d0 + c0 z)^2]))/( > d0 + c0 z))] + ((0. + 2. I) a Log[( > 2 d0 ((I (-a^2 + d0 (d0 + c0 z)))/Sqrt[a^2 - d0^2] + > Sqrt[-a^2 + (d0 + c0 z)^2]))/z])/Sqrt[a^2 - d0^2] > > Note all the "I"s. This is a fairly simple answer returned. I doubt > that is the only solution. When I evaluate it for cases of interest, I get > complex numbers, which can't be right in my particular case which is > based on a physical problem. > > > Thanks for any insights. > > -- > Tony Mannucci The integrand will be complex whenever -a^2 + z^2 (c0 + d0/z)^2<0, as the square root in the denominator will then yield complex values. It is therefore not surprising that the general solution of the integral has the given form. I haven't checked explicitly, but I'm pretty sure that the result given by Mathematica will reduce to real values whenever above condition is violated. Best regards, Sebastian