com.metsci.glimpse.util.math.fast
Class FastGaussian

java.lang.Object
  extended by com.metsci.glimpse.util.math.fast.FastFunc
      extended by com.metsci.glimpse.util.math.fast.FastGaussian

public class FastGaussian
extends FastFunc

An approximation to a univariate gaussian pdf of mean zero, deviation 1. The width of the interval over which the function is sampled is chosen as a function of the number of sample points to match the maximum error within the table (which occurs at x = 1, where the slope is maximal) with that at the boundary of the interval, outside of which the function is assumed to be identically zero. It turns out that the exact value is given by: a = sqrt(W(exp(1)*n*n)), where W(z) is the Lambert function, [-a,a] is the interval over which the function should be tabulated, and n is the number of sample points. For our purposes, the following asymptotic approximation to W(z) is sufficient: W(z) ~ ln(z) - ln(ln(z)) + ln(ln(z))/ln(z). Maximum magnitude of approximation error as a function of n: n error interval where non-zero ------ ---------- ----------------------- 100 6.89x10^-3 [-2.85 , +2.85] 1000 8.49x10^-4 [-3.51 , +3.51] 10000 9.86x10^-5 [-4.08 , +4.08] 100000 1.11x10^-5 [-4.58 , +4.58] Minimum value of n as a function of required accuracy: accuracy n -------- --------- < 10^-2 >= 66 < 10^-3 >= 838 < 10^-4 >= 9854 < 10^-5 >= 111381

Author:
ellis

Constructor Summary
FastGaussian(int samples)
           
 
Method Summary
 double evaluate(double x)
           
static FastGaussian getInstance()
           
 
Methods inherited from class com.metsci.glimpse.util.math.fast.FastFunc
lookup, lookup
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastGaussian

public FastGaussian(int samples)
Method Detail

getInstance

public static FastGaussian getInstance()

evaluate

public double evaluate(double x)
Overrides:
evaluate in class FastFunc


Copyright © 2012 Metron, Inc.. All Rights Reserved.