Let’s us finish with the distribution functions for the HP Prime. Remember that we posted two blog issues about it: here and here.
All were taken from user Salvomic in HPmuseum. This is a monumental job and a great help for those that cannot bear to have an approximation when you can have the real thing.
Here are the last ones:
EXPORT rayleigh(s, t)
// Rayleigh distribution s=σ scale parameter, t>=0 var
// rayleigh(2σ2) = weibull(σ*sqrt(2),2)
BEGIN
local f;
f:= piecewise(t<0, 0, ((t/(s2))*e(-(t2)/(2*(s2)))));
return f;
END;
EXPORT rayleigh_cdf(s, t)
BEGIN
local f;
f:= piecewise(t<0, 0, 1 - e(-t2/(2*(s2))));
return f;
END;
Pareto distribution
EXPORT paretod(xm, a, k)
// Pareto distribution x_m >0 scale, a=α > 0 shape
BEGIN
local f;
IF ((a<=0) OR (xm <= 0) OR (k<xm)) THEN RETURN(“Use: xm > 0, a >0, k >= xm”); END;
f:=(a*xma)/k(a+1);
return f;
END;
EXPORT paretod_cdf(xm, a, k)
BEGIN
local f;
IF ((a<=0) OR (xm <= 0) OR (k<xm)) THEN RETURN(“Use: xm > 0, a >0, k >= xm”); END;
f:=1-(xm/k)^a;
return f;
END;
EXPORT paretod_bound(a, L, H, k)
// Bounded Pareto distribution
// a=α >0 shape, L>0, H>L location, k var
BEGIN
local f;
IF (a<=0 OR L<=0 OR H<=L) THEN RETURN(“Use a>0, L>0, H>L”); END;
f:= (a*La*k(-a–1))/(1-(L/H)^a);
return f;
END;
EXPORT paretod_bnd_cdf(a,L,H,k)
BEGIN
local f;
IF (a<=0 OR L<=0 OR H<=L) THEN RETURN(“Use a>0, L>0, H>L”); END;
f:= (1-La*k(-a))/(1-(L/H)^a);
return f;
END;
n-Erlang distribution
EXPORT erlang(k,l,n)
// n-Erlang distribution k shape parameter, l=λ >=0 rate parameter
// from Gamma d.; if k=1 -> erlang(1,l,n) = exponential(l,n)
// erlang(k,λ) = gamma(k,1/λ)
BEGIN
local f;
f:=piecewise(n<0,0, l<0, 0, ((lk)*(n(k–1)e^(-ln)))/(k–1)! );
END;
EXPORT erlang2(k, m, n)
//k shape parameter, m=μ=1/λ >=0 scale parameter
// if μ=2 -> chi2 with 2k degree of freedom
BEGIN
local f;
f:=piecewise(n<0,0, m<0, 0, (n(k-1)*e(-n/m))/((mk)*(k–1)!));
END;
EXPORT erlang_cdf(k, l, n)
// k shape parameter, l=λ >=0 rate parameter (μ=1/λ)
BEGIN
local f;
f:= 1- sum((1/X!)*(e(-l*n))*(l*n)X,X,0,k–1);
END;