The OpenD Programming Language

laplaceLPDF

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

  1. T laplaceLPDF(T x)
  2. T laplaceLPDF(T x, T location, T scale)
    T
    laplaceLPDF
    (
    T
    )
    (
    const T x
    ,
    const T location
    ,
    const T scale
    )
    if (
    isFloatingPoint!T
    )

Parameters

x T

value to evaluate LPDF

location T

location parameter

scale T

scale parameter

Examples

import mir.math.common: log;
import mir.test: shouldApprox;

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

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

See Also

Meta