The OpenD Programming Language

geometricCDF

Computes the geometric cumulative density function (CDF).

  1. T geometricCDF(size_t k, T p)
    @safe pure @nogc nothrow
    T
    geometricCDF
    (
    T
    )
    (
    const size_t k
    ,
    const T p
    )
    if (
    isFloatingPoint!T
    )
  2. T geometricCDF(T x, T p)

Parameters

k size_t

value to evaluate CDF

p T

true probability

Examples

import mir.test: shouldApprox;

geometricCDF(-1.0, 0.5).shouldApprox == 0; // UFCS chaining deduces this as size_t instead of a floating point type
0.geometricCDF(0.5).shouldApprox == 0.5;
1.geometricCDF(0.5).shouldApprox == 0.75;
2.geometricCDF(0.5).shouldApprox == 0.875;

geometricCDF(-1.0, 0.25).shouldApprox == 0; // UFCS chaining deduces this as size_t instead of a floating point type
0.geometricCDF(0.25).shouldApprox == 0.25;
1.geometricCDF(0.25).shouldApprox == 0.4375;
2.geometricCDF(0.25).shouldApprox == 0.578125;
2.5.geometricCDF(0.25).shouldApprox == 0.578125;

See Also

Meta