Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to integrate the following:

Integrate[(2*Cos[Sqrt[F]*z - G])/E^(D*(p + z)^2),  {z, -(h/2), h/2}]

I am getting solution in complex domain:

(1/(2 Sqrt[D]))E^(-(F/(4 D)) - I (G + Sqrt[F] p)) Sqrt[π] (E^(2 I (G + Sqrt[F] p)) 
(-Erf[(I Sqrt[F] - D h + 2 D p)/(2 Sqrt[D])] + 
  Erf[(I Sqrt[F] + D (h + 2 p))/(2 Sqrt[D])]) + 
  I (Erfi[(Sqrt[F] - I D (h - 2 p))/(2 Sqrt[D])] - 
      Erfi[(Sqrt[F] + I D (h + 2 p))/(2 Sqrt[D])]))

What do I do to force Mathematica to report solution only in real domain?

share|improve this question
First, it is better to use lowerCase letters. In particular D is used by Mathematica for derivative. so this is better: Integrate[(2*Cos[Sqrt[f]*z - g])/E^(d*(p + z)^2), {z, -(h/2), h/2}]], also, just because I shows up in the solution, does not mean the solution is complex, since I can cancel out. Is this solution Exp[I x] + Exp[-I x] complex?, and finally, if you can't find the right assumptions to limit solutions in the Reals, what is wrong with simply filter these out after obtaining the solution? but again, you want to make sure the solution is actually complex when simplified. –  Nasser Nov 16 '13 at 1:58
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.