The OpenD Programming Language

cauchyLPDF

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

  1. T cauchyLPDF(T x)
  2. T cauchyLPDF(T x, T location, T scale)
    @safe pure nothrow @nogc
    T
    cauchyLPDF
    (
    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;

cauchyLPDF(-3.0).shouldApprox == log(0.03183099);
cauchyLPDF(-2.0).shouldApprox == log(0.06366198);
cauchyLPDF(-1.0).shouldApprox == log(0.1591549);
cauchyLPDF(0.0).shouldApprox == log(0.3183099);
cauchyLPDF(1.0).shouldApprox == log(0.1591549);
cauchyLPDF(2.0).shouldApprox == log(0.06366198);
cauchyLPDF(3.0).shouldApprox == log(0.03183099);

// Can include location/scale
cauchyLPDF(-3.0, 1, 2).shouldApprox == log(0.03183099);
cauchyLPDF(-2.0, 1, 2).shouldApprox == log(0.04897075);
cauchyLPDF(-1.0, 1, 2).shouldApprox == log(0.07957747);
cauchyLPDF(0.0, 1, 2).shouldApprox == log(0.127324);
cauchyLPDF(1.0, 1, 2).shouldApprox == log(0.1591549);
cauchyLPDF(2.0, 1, 2).shouldApprox == log(0.127324);
cauchyLPDF(3.0, 1, 2).shouldApprox == log(0.07957747);

Meta