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