# How to solve this equation with error functions?

I'd like to solve the following equation for $S$, in terms of $p, x,$ and $\sigma$:

$$p = \int_0^x\sqrt{\frac{2}{\pi}} \frac{e^{\frac{-(S-\mu)^2}{2\sigma^2}}}{\mathrm{erf}\left(\frac{S}{\sqrt{2}\sigma}\right)- \mathrm{erf}\left(\frac{S-1}{\sqrt{2}\sigma}\right)} d\mu$$

Solving the integral as Mhenni suggested yields: $$p = \frac{\frac{\sqrt{2}}{2}\left(\mathrm{erf}\left(\frac{S-x}{\sqrt{2}\sigma}\right) - \mathrm{erf}\left(\frac{S}{\sqrt{2}\sigma}\right) \right)}{{\mathrm{erf}\left(\frac{S}{\sqrt{2}\sigma}\right)- \mathrm{erf}\left(\frac{S-1}{\sqrt{2}\sigma}\right)}}$$

The problem now is dealing with the $S$'s inside the error functions. I know there's an inverse error function ($\mathrm{erf}^{-1}$), but I don't see how this is ultimately solvable for $S$.

Is this possible?

Thanks for any help!

• Make change of variables $(S-\mu) /(\sqrt{2}\sigma) =t$ and then use the erf function. – Mhenni Benghorbal Mar 4 '16 at 4:23
• So then I would be integrating with respect to $t$, since $t$ would contain $\mu$? – sundance Mar 4 '16 at 4:36
• You will be integrating with respect to $t$! It is just a change of variables! Do you know how make integration but substitution? – Mhenni Benghorbal Mar 4 '16 at 4:38
• It's been a while but yes. But I'm not sure how to integrate the error function. – sundance Mar 4 '16 at 4:43
• What are you doing? The denominator does not depend on $\mu$? Also you need to change the limits of integration too! By the way where did this problem come from? – Mhenni Benghorbal Mar 4 '16 at 4:43

I suppose that there are some typo's.

The result I obtained is $$p=\sigma\frac{ \text{erf}\left(\frac{S}{\sqrt{2} \sigma }\right)-\text{erf}\left(\frac{S-x}{\sqrt{2} \sigma }\right)}{\text{erf}\left(\frac{S}{\sqrt{2} \sigma }\right)-\text{erf}\left(\frac{S-1}{\sqrt{2} \sigma }\right)}$$ I do not think that you could be able to solve analytically the equation for $S$. More than likely, only numerical methods could do it.

If you provide some typical values for $p,\sigma,x$, I could look at some numerical scheme.

• Thanks for your help! The constraints are $0 \leq p \leq 1$, $0 < \sigma \leq 1$, $0 \leq x \leq 1$, not sure if that helps. – sundance Mar 4 '16 at 5:45
• You are welcome ! Again, I cannot imagine any anlytical solution. If you want, give me one value for each of the three parameters. – Claude Leibovici Mar 4 '16 at 5:47

You have not changed to limits of integration

$$p = \frac{ \sqrt{\frac{2}{\pi}} }{ {\mathrm{erf}\left(\frac{S}{\sqrt{2}\sigma}\right)- \mathrm{erf}\left(\frac{S-1}{\sqrt{2}\sigma}\right)}} \int_{S/(\sqrt{2}{\sigma}) }^{ (S-x) /(\sqrt{2}{\sigma}) } e^{-t^2} dt.$$

• Right, sorry, fixed that I think. This should be $dt$, right? I'm imagining though that once I solve the integral I still may not be able to solve the equation for $S$. – sundance Mar 4 '16 at 5:16