The OpenD Programming Language

cauchyPDF

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

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

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

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

Meta