error_function.zip (5 kB)
The error function erf and its complementary erfc, the version which can be found in Sun's library (Cody's solution and thus
only for Reals), but ready to use. For its cousin - the cumulative normal distribution - see the main page (and the VBA code)
or use cdfN(x) = ( 1 + erf(x/sqrt(2)) ) / 2, but be aware that this always will introduce some relative errors.
MillsRatio.zip (3 kB)
Mills' ratio (or the inverse of the hazard function) and defined as (1 - cdfN(x))/pdfN(x)and thus also can by used to
compute the cumulative normal distribution. The absolute and relative errors are ~ 2 * DBL_EPSILON and the test report
regards the IEEE representation for doubles, Mills_IEEE.pdf (459 kB).
LambertW.cpp (1 kB)
Lambert's W function solves the equation x = y * exp(y) = y + y^2 + y^3/2 + y^4/6 + y^5/24 + ...
y = LambertW(x) is a kind of log for that. Over the positive Reals it can be computed by Newton's method, which converges
quickly (~ 3 steps) with relative error below 2 * DBL_EPSILON (absolute error below DBL_EPSILON for x= 0 .. 1).
gamma_lanzos.zip (4 kB)
Gamma function for complex inputs, which also works very close the the poles in negative integers. Basically it uses Godfrey's
method (which however seems to have problems in those regions). The tests for accuracy are done with Maple (using high
precision and regarding IEEE representation for doubles), here are some test results: gamma_lanczos_NP_test.pdf (20 kB).
function 2F1 function (internal link)
For Gauss' function, complex case for parameters and variable, has its own URL. Note it is the function, not merely the series
in the unit disk.
07 Jun 2010: uploaded
This software is provided "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.