# Rewriting the integral $\mathrm{erf}(x) = \frac{1}{\sqrt{\pi}} \int_{-x}^x e^{-t^2} dt.$

I'm trying to implement an equation into a programming language which doesn't have functions for integrals. However as it's many years since I've had any math exercise I'm having some trouble understanding how I can simplify the following equation.

$$\mathrm{erf}(x) = \frac{1}{\sqrt{\pi}} \int_{-x}^x e^{-t^2} dt.$$

As an example would it be correct to refactor the equation as follows?

$$\frac{1}{\sqrt{\pi}} \cdot \left(x \cdot e^{-x^2}+(-x) \cdot e^{x^2}\right)$$

Please forgive me if I'm completely off target! As I said, it's been quite a few years since I've had integrals.

• It can't be simplifed. Your programming language probably has a function for it though. It is called the "error function". – Samuel Apr 9 '13 at 8:47
• You might want to see this. – J. M. is a poor mathematician Apr 9 '13 at 8:58