# Strange behaviour of integrals with Cos, Sin, and Exp

Bug introduced in 8.0.4 or earlier and persisting through 11.0.1

During the study of the problem How to solve this integration? I have discovered a strange behaviour of some integrals.

I would consider it a bug.

\$Version

(* Out[39]= "10.1.0  for Microsoft Windows (64-bit) (March 24, 2015)" *)


Consider these integrals

c =
Integrate[E^-Sqrt[u/2] Cos[ Sqrt[u/2] - u z], {u, 0, ∞}, Assumptions -> {z > 0}]

(*
Out[34]= (E^(-(1/4)/z) Sqrt[π])/(2 z^(3/2))
*)

s =
Integrate[E^-Sqrt[u/2] Sin[ Sqrt[u/2] - u z], {u, 0, ∞}, Assumptions -> {z > 0}]

(*
Out[35]= -(1/z) + (E^(-(1/4)/z) Sqrt[π] Erfi[1/(2 Sqrt[z])])/(2 z^(3/2))
*)


Now form cs = c + I s which can be written, using Euler's fomula, as

cs =
Integrate[E^-Sqrt[u/2] Exp[I (Sqrt[u/2] - u z)], {u, 0, ∞},
Assumptions -> {z > 0}] (* wrong *)

(*
Out[36]= (I (-Sqrt[z] + DawsonF[1/(2 Sqrt[z])]))/z^(3/2)
*)

FunctionExpand[%]

(*
Out[4]= (I (-Sqrt[z] + 1/2 E^(-(1/4)/z) Sqrt[π] Erfi[1/(2 Sqrt[z])]))/z^(3/2)
*)


But this result is wrong because it "forgets" the real part and gives only the imaginary part I s. The same happens with the assumptions of real z.

Dropping the assumptions completely we get the result

Integrate[E^-Sqrt[u/2] Exp[I (Sqrt[u/2] - u z)], {u, 0, ∞}]

(*
Out[38]=
ConditionalExpression[
-(I/z) + (E^(-(1/4)/z) Sqrt[π] (1 + I Erfi[1/(2 Sqrt[z])]))/(2 z^(3/2)),
Im[z] < 0]
*)


which is correct only if we neglect the generated condition.

• I agree it's a bug. But how to make a question out if this? I tried substitution of variables, introducing another parameter, but couldn't find a workaround using Integrate, unfortunately. – Jens Mar 29 '16 at 3:51
• I was able to verify this as well. It appears to be a bug. I've found other problems with symbolic integration which I thought had crept in with MMA 10. However, I just ran my notebook in MMA 9 and got the same--erroneous--result. Since I have Premier service, I'm going to submit this problem to the technicians and see what they come up with. – DSkinner May 1 '16 at 3:20
• From the comments three people feel this is a bug and none have suggested otherwise, so I am adding the tag. If anyone know which versions are affected please add the standard bugs header. – Mr.Wizard Jul 15 '16 at 9:42