Wednesday, January 17, 2007

Gaussian Integral Approximations

In the ongoing debate over the veracity and utility of Wikipedia, I noticed one critic claiming Wikipedia tends to be better with highly technical articles, because interest is limited to an elite few. This is an observation that squares with my own experience. When it comes to questions mathematical, I often even find Wikipedia superior to MathWorld, with the former frequently going into greater length and detail than the latter.

As far as things mathematical go, I have noticed many a Wiki entry referencing Handbook of the Mathematical Functions, edited by Irene Stegun and Milton Abramowitz from the National Bureau of Standards. It's an older reference (last printed in '72), but it's in the public domain, and it's available online in scanned form (here, for example).

After finding the +900 pages of online scans a little unwieldy, I decided to simply get a copy, which can be had in paperback from used book sites for as little as ten bucks, shipping included. "Designed to provide scientific investigators with a comprehensive and self-contained summary of the mathematical functions that arise in physical and engineering problems," it contains a lot of useful information. For example, there are some great approximations in it, such as those for the Gaussian Integral here on page 932.

And this brings us to the second part of this post.

A while back, I was playing with some different means of calculating the Gaussian Integral. First, I searched for an extremely accurate version to serve as a baseline. I turned to W.J. Cody's ERF function, found in ACM Algorithm 462, which claims accuracy of 18 significant digits.

Yes, this involved FORTRAN spelunking. I cranked up f2c for the first time in a long time. While the conversion seemed to go fine, my outputs indicated something somewhere went wrong. A brief attempt at compiling with gfortran exceeded my limited patience, so in the end I wound up porting it by hand. (In retrospect, I should have recorded a Visual Studio macro while busily changing ".LE." to "<=", etc.)

In the end, thanks to Cody, Stegun and Abramowitz, I coded up four different approximations for the Gaussian Integral. The implementations are available with results for perusal here.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home