Evaluating tricky definite complex integral and getting numerical result as a single complex number

29 Views Asked by At

For given constants $a\in \mathbb{R}$ and $b \in \mathbb{R}$ and I would like to numerically evaluate the following complex integral

$$\int_{-1}^{1} (1-|x|) \exp(ia(b+x)^2) \, d\mathrm{x}. $$

I am not good in complex integration at all but using Wolfram alpha I got these identities $$ \int_{-1}^{1} x \exp(iax^2) \, d\mathrm{x} = 0, $$

$$ \int_{-E}^{E} |x| \exp(iax^2) \, d\mathrm{x} = -\frac{i(-1+e^{iaE^2})}{a}, $$

$$ \int_{-E}^{E} \exp(iax^2) \, d\mathrm{x} = -\frac{\sqrt[-4]{-1} \sqrt{\pi} \mathrm{erf}((-1)^{3/4} \sqrt{a} E)}{\sqrt{a}} $$ and so $$ \int_{-1}^{1} |x| \exp(iax^2) \, d\mathrm{x} = -\frac{i(-1+e^{ia})}{a}, $$

$$ \int_{-1}^{1} \exp(iax^2) \, d\mathrm{x} = -\frac{\sqrt[-4]{-1} \sqrt{\pi} \mathrm{erf}((-1)^{3/4} \sqrt{a})}{\sqrt{a}} $$

Using these and completing the square I can symbolically evaluate the original integral.

Now how about numerical evaluation. In C++ there is erf function implemented in cmath header. But how to evaluate $\sqrt[-4]{-1}$ and $(-1)^{3/4}$? Does the integral has multiple solutions? And is there one solution, which is somehow more natural then others to use it as a result of numerical integration?