This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.
The output y is a normalized piecewise linear probability distribution function specified by a list of points {{x1,f(x1)}, {x2,f(x2}}, ... ,{xn, f(xn)}
, where the support may be rescaled to the unit interval (rescaleQ = true
) and the area under the curve is equal to one.
If the normalization constant is not greater than zero, the function will simply return the input, albeit with possibly rescaled first dimension.
Functions.normalizePLpdf({{x1,y1},{x2,y2}, ...}); // rescaleQ = true Functions.normalizePLpdf({{x1,y1},{x2,y2}, ...}, rescaleQ = false);
normalizePLpdf({{0,2},{5,2},{10,2}}); // {{0,1},{0.5,1},{1,1}} normalizePLpdf({{0,0},{5,1},{10,0}}); // {{0,0},{0.5,2},{1,0}} normalizePLpdf({{0,2},{5,2},{10,2}}, false); // {{0,0.1},{5,0.1},{10,0.1}}
encapsulated function normalizePLpdf import BusinessSimulation.Icons.Function; import BusinessSimulation.Functions.{rescaleVector,areaLineSegment,normalizationConstant}; extends Function; input Real[:, 2] plPDF "Piecewise linear probability density function, i.e., { p1, p2, ... }"; input Boolean rescaleQ = true "= true, if support is to be rescaled to the unit interval"; output Real[size(plPDF, 1), 2] y "Normalized distribution density function with support [0,1]"; end normalizePLpdf;