MathGroup Archive 2011

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

Search the Archive

Keeping it real

  • To: mathgroup at
  • Subject: [mg120246] Keeping it real
  • From: amannuc <amannuc at>
  • Date: Thu, 14 Jul 2011 21:20:08 -0400 (EDT)

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 *
((-d0/z^2)/(c0 + d0/z))/Sqrt[-a^2 + z^2 (c0 + d0/z)^2],
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

  • Prev by Date: Compile and Total
  • Next by Date: Re: Numerical accuracy/precision - this is a bug or a feature?
  • Previous by thread: Re: Compile and Total
  • Next by thread: Re: Keeping it real