Pregunta

I've been looking at algorithms used to calculate various functions, such as the CORDIC algorithm for tigonometric functions.

I was wondering how the error function is usually calculated. Wikipedia has a number of approximations, but is there one algorithm that is generally preferred when coding the error functions for numerical computing?

¿Fue útil?

Solución

Your best bet is to check what actual implementations do, here is a selection:

  1. Boost: http://www.boost.org/doc/libs/1_55_0/boost/math/special_functions/erf.hpp

  2. GNU Scientific Library: http://www.gnu.org/software/gsl/

  3. GLibc http://www.gnu.org/software/libc/index.html

There are probably others.

Otros consejos

If you are looking for basic ideas on how these algorithms work instead of the exact details, then you should know that the Taylor expansion for these functions usually provides the asymptotic optimal way to compute them (either directly or with a re-expression), so it basically just boils down to how you refine the computation of the Taylor expansion. If you are unfamiliar with Taylor expansions and how they relate to functions like erf, see http://en.wikipedia.org/wiki/Taylor_series and http://en.wikipedia.org/wiki/Error_function#Taylor_series

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top