cdf method

num cdf(
  1. num x
)

Gives the normal cumulative distribution function.

Approximation within 7.5E-8 (Abramowitz 26.2.17) of the cumulative probability.

Implementation

num cdf(num x) {
  final z0 = (x - mean) / standardDeviation,
      z = z0.abs(),
      t = 1 / (1 + _p * z),
      tps = [for (var i = 0; i < _nb; i++) math.pow(t, i + 1)],
      c = _standardDensity(z) *
          [for (var i = 0; i < _nb; i++) _b[i] * tps[i]]
              .fold(0, (a, b) => a + b);
  return z0 < 0 ? c : 1 - c;
}