# Integrating the product of two imaginary error functions

I am trying to evaluate the following integral:

Integrate[Erfi[y] Erfi[z + y] , {y, -L, L}]


which simply returns the input. How could I force Mathematica to return a solution to this problem. This question is in fact a reduction of the problem I actually have, which is:

gplus[i_] := 2 k s^2 (L1 + y[i]) - I R (L1 + mu[i])
gminus[i_] := 2 k s^2 (-L1 + y[i]) + I R (L1 - mu[i])
gplusconj[i_] := 2 k s^2 (L1 + y[i]) + I R (L1 + mu[i])
gminusconj[i_] := 2 k s^2 (-L1 + y[i]) - I R (L1 - mu[i])

Integrate[(Erfi[gplusconj[i]] - Erfi[gminusconj[i]]) (Erfi[gplus[i]] - Erfi[gminus[i]]) , {y[i], -L2, L2}]


where mu[i] is a table of constants. I deliberately try to evaluate this in the form it stands since I wish to store the outcome of the integration as a function. This will circumvent many evaluations of the same type of integral but with different values with $i$.

Thanks.

• Mathematica does not know of a solution to your integral as written. Perhaps an analytical solution might not even exist. In all likelihood you will be limited to estimating the integral numerically after having introduced appropriate values of your parameters $z$ and $L$. Nov 9, 2015 at 18:05

This integral is unknown to Mathematica and indeed it appears that there is no simple solution at all. You can try rooting around the DLMF, and using the relations of $\operatorname{erfi}$ to the incomplete gamma and Kummer $M$ functions to look for similar relations in the standard books of integrals (such as Gradshteyn & Ryzhik, Prudnikov et al., Erdelyi et al., and so on), but I had a look and there's nothing remotely hopeful in there. Whatever you find will probably be quite ugly.

As such, your best bet is to encapsulate your integral into a single function which you can then evaluate numerically when needed. Using your simple example as a starting point,

f[z_?NumericQ, L_?NumericQ] := NIntegrate[Erfi[y] Erfi[z + y], {y, -L, L}]
LogPlot[f[z, 1], {z, -3, 3}]


produces the plot below without a complaint in a couple of seconds.

For your more complicated case, it depends what you want to do with your bigger integral, but you probably want to hold off on the integration and simply do it numerically when it's needed. An analytical result is not likely to be possible, unless you have some guarantee that it is (in which case, edit the question to make it clear why you expect the integral to be doable at all).

Whether direct numerical integration is the best strategy or not (versus e.g. doing some transformation or series representation on the error functions before integrating, which could then be exact) is potentially up for grabs, but unless you have very good reasons to think otherwise, the starting assumption should be that if there's something clever to be done to the integrand to do it numerically, Mathematica's NIntegrate is probably already doing it behind the scenes.

• Thanks for your ideas Emilio! I do not expect an analytic result. My initial approach which I am still pursuing is the Maclaurin series expansion of both of the Erfi(x) and then evaluating the integral. The efficiency is important but am unsure how compares with the ideas you have given.
– Sid
Nov 9, 2015 at 19:31