Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

qnorm_pdf(n, N, m, s, u, q)
% qnorm_pdf.m - evaluates a q-normal Probability Density.
%     "q-Probability: I. Basic Discrete Distributions", 
%     B. Kupershmidt, J. Nonlinear Math., vol. 7, No. 1 p.73, 2000.
%
%  Created by Jim Huntley,  03/01/07
%

function [pdf] = qnorm_pdf(n, N, m, s, u, q)

%persistent Q x

%if(isempty(Q))
    Q = q^(-s);
    x = (Q^N - 1) / (Q - 1);
%end

prodx = x;
prodk = 1;
proda = 1;
prodb = 1;
prodc = 1;    
for jx = 1:n
    xp = (Q^(N-jx) - 1) / (Q - 1);
    prodx = prodx * xp;
end
for jk = 1:n+1
    kp = (Q^jk - 1) / (Q - 1);
    prodk = prodk * kp;
end
for ja = 1:n
    proda = proda * (m + (ja-1)*s);
end
for jb = 1:N-n
    prodb = prodb * (u + (jb-1)*s);
end
for jc = 1:N
    prodc = prodc * (m + u + (jc-1)*s);
end

pdf = q^((m+s*n)*(N-n)) * prodx * proda * prodb / (prodk * prodc);

return


Contact us