Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

relbw_pdf(x, M, Gamm)
% relbw_pdf.m - evaluates a Relativistic Breit Wigner Probability Density.
%   See "Relativistic Breit-Wigner Distribution", Wikipedia 
%  Created by Jim Huntley,  08/64/11

function [pdf] = relbw_pdf(x, M, Gamm)

%persistent Msq Gammsq gam k

    Msq = M^2;
    Gammsq = Gamm^2;
    gam = sqrt(Msq*(Msq+Gammsq));
    k = 2*sqrt(2)*M*Gamm*gam / (pi*(sqrt(Msq+gam)));

pdf = k ./ ((x.^2-Msq).^2+Msq*Gammsq);


Contact us