The OpenD Programming Language

laplacePDF

Ditto, with location and scale parameters (by standardizing x).

  1. T laplacePDF(T x)
  2. T laplacePDF(T x, T location, T scale)
    @safe pure nothrow @nogc
    T
    laplacePDF
    (
    T
    )
    (
    const T x
    ,
    const T location
    ,
    const T scale
    )
    if (
    isFloatingPoint!T
    )

Parameters

x T

value to evaluate PDF

location T

location parameter

scale T

scale parameter

Examples

import mir.test: shouldApprox;

laplacePDF(-2.0).shouldApprox == 0.06766764;
laplacePDF(-1.0).shouldApprox == 0.1839397;
laplacePDF(-0.5).shouldApprox == 0.3032653;
laplacePDF(0.0).shouldApprox == 0.5;
laplacePDF(0.5).shouldApprox == 0.3032653;
laplacePDF(1.0).shouldApprox == 0.1839397;
laplacePDF(2.0).shouldApprox == 0.06766764;

// Can also provide location/scale parameters
laplacePDF(-1.0, 2.0, 3.0).shouldApprox == 0.06131324;
laplacePDF(1.0, 2.0, 3.0).shouldApprox == 0.1194219;
laplacePDF(4.0, 2.0, 3.0).shouldApprox == 0.08556952;

Meta