1

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.

netbrain
  • 169

1 Answers1

1

You can find many facts about the error function here: Error function

For example have a look at the sections Taylor series and Approximation with elementary functions - they might help you to implement this function into your programming language.

vonjd
  • 9,040