Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

 

generates random variates from over 870 univariate distributions

narayana_pdf(n, nn)
% narayana_pdf.m - evaluates a Singh Poisson Probability Density.
%   See "q-Narayana Numbers and the Flag h-Vector of J(2 x n)", P. Branden, 11/08/02.
%
%  Created by Jim Huntley,  8/02/06
%

function [pdf] = narayana_pdf(n, nn)

%persistent sumn

%if(isempty(sumn))
    sumn = 0;
    for jn = 1:nn
        sumn = sumn + binomial_coef(nn,jn) * binomial_coef(nn,jn+1) / nn;
    end
%end
 
pdf = binomial_coef(nn,n-1) * binomial_coef(nn,n) / (nn * sumn);

return

Contact us