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);
Ditto, with location and scale parameters (by standardizing x).