The OpenD Programming Language

uniformLPDF

Computes the uniform log probability density function (LPDF)

@safe pure nothrow @nogc
T
uniformLPDF
(
T
)
(
const T x
,
const T lower = 0
,
const T upper = 1
)
if (
isFloatingPoint!T
)

Parameters

x T

value to evaluate LPDF

lower T

lower bound

upper T

upper bound

Examples

import mir.math.common: approxEqual, log;
assert(0.5.uniformLPDF == 0);
assert(0.5.uniformLPDF(0.0, 1.5).approxEqual(-log(1.5)));
assert(1.5.uniformLPDF(1.0, 3.0).approxEqual(-log(2.0)));

See Also

Meta