0
$\begingroup$

I want to compute the integral $$ \int_0^c \exp(-cx+x^2) \mathrm{d}x, $$ where $c>0$ is an unknown constant. In Mathematica Version 12.2.0

$Version

(* 12.2.0 for Microsoft Windows (64-bit) (December 12, 2020) *)

I evaluate the integral and I obtain

Integrate[Exp[-c*x + x^2], {x, 0, c}, Assumptions -> {c > 0}]

(* E^(-(c^2/4)) Sqrt[\[Pi]] Erfi[c/2] *)

Why do I obtain a complex expression? Is it a bug or I am doing something wrong?

$\endgroup$
5
$\begingroup$
$Version

(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)

int[c_] = Integrate[Exp[-c*x + x^2], {x, 0, c}]

(* E^(-(c^2/4)) Sqrt[π] Erfi[c/2] *)

Erfi is real for real c

FunctionDomain[int[c], c]

(* True *)

Plot[int[c], {c, -15, 15}]

enter image description here

For an alternate representation using DawsonF (EDIT: Eliminated unnecessary assumption)

int[c] // FullSimplify

(* 2 DawsonF[c/2] *)
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.