Article 6T0ZX Simple error function approximation

Simple error function approximation

by
John
from John D. Cook on (#6T0ZX)

I recently ran across the fact that

sinsinerf3.svg

is a remarkably good approximation for -1 x 1.

Since the integral above defines the error function erf(x), modulo a constant, this says we have a good approximation for the error function

sinsinerf4.svg

again provided -1 x 1.

The error function is closely related to the Gaussian integral, i.e. the normal probability distribution CDF . The relation between erf and is simple but error-prone. I wrote up some a page notes for myself a few years ago so I wouldn't make a mistake again moving between these functions and their inverses.

Update: This post makes the connection to probability explicit.

You can derive the approximation by writing out the power series for exp(t), substituting -t^2 for t, and integrating term-by-term from 0 to x. You'll see that the result is the same as the power series for sine until you get to the x5 term, so the error is on the order of x5. Here's a plot of the error.

sinsinerf.png

The error is extremely small near 0, which is what you'd expect since the error is on the order of x5.

The post Simple error function approximation first appeared on John D. Cook.
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments