Constructor
Numeric cumulative density function of standard normal distribution
import std.traits, std.mathspecial; import atmosphere.pdf; class NormalPDF : PDF!real { real opCall(real x) { // 1/sqrt(2 PI) enum c = 0.398942280401432677939946L; return c * exp(-0.5f * x * x); } } class NormalCDF : NumericCDF!real { this() { super(new NormalPDF, [-3, -1, 0, 1, 3]); } } auto cdf = new NormalCDF; assert(approxEqual(cdf(1.3), normalDistribution(1.3)));
Class to compute cumulative density function as integral of it's probability density function. Unstable algorithm.