### RE: how to generate a random distribution

Emmanouil Ioannis Chaniotakis <e.chaniot <at> cern.ch>

2014-11-03 21:12:00 GMT

Thank you very much for your reply.
I would like to apologize if I went off the guidelines of roottalk in my question.
Best regards,
Manuel
________________________________________
From: Jacques Goldberg [jacques.goldberg <at> lingacom.com]
Sent: 03 November 2014 22:24
To: Emmanouil Ioannis Chaniotakis; roottalk (Mailing list for ROOT users.)
Subject: Re: how to generate a random distribution
Manuel
1- this is definitely not a ROOTTALK issue so following this mail, if you need further help, please write to
personal addresses only, not roottalk
2-You MUST forget any inclusion even as lower limit, of the zero SINGULARITY. See the definition of a pdf
(probability density function) in any textbook. Let me recommend to you DATA ANALYSIS FOR SCIENTISTS AND
ENGINEERS by
Stuart L. Meyer. The integrated probability , integral of the pdf, must be monotonic between 0 and 1. You
CAN'T do that with a point where it would be INFINITE. The interval [0,5] is illegal.
.
3-Assume you would agree to satisfy yourself to the interval [0.1,5] for example. You cannot arbitrarily
set k in addition to a and b to follow a pdf k*x ^-2 and expect the mean nor the FWHM to be arbitrarily set, not
even one of them.
The mean is (Integral of x*kx^-2 over [a,b])/(b-a). The RMS formula, not to say the FWHM, is even more complicated.
If you agree to accept it tthere is one value of k which will give the req uested mean which MUST be within t he
integration rang. Forget about more (FWHM).
4-Friendly advice: take a basic probabilities & statistics course. A t least study the book I r ecommended.
And DROP copies to roottalk about this subject.
Jacques
On 11/03/2014 09:17 PM, Emmanouil Ioannis Chaniotakis wrote:
Thank you very much.
The range is from 0 to 5 .
However, I want the mean value and the FWHM to be specified by me.
How could I do it?
Best regards,
Manuel
________________________________________
From: Jacques Goldberg [jacques.goldberg <at> lingacom.com<mailto:jacques.goldberg <at> lingacom.com>]
Sent: 03 November 2014 20:15
To: Emmanouil Ioannis Chaniotakis; roottalk (Mailing list for ROOT users.)
Subject: Re: how to generate a random distribution
The primitive is -k/x
You did not specify the range of the variable thus if -oo to +oo you can't proceed nor in any range containing x=0.
If you want the variable in a finite range, negative or positive but not both because of the x=0 singularity,
you will compute C=-k(1/b-1/a) , draw X from a flat random and solve for x the equation X=-k/x/C because the
integral of you probability k*x^(-2)/C over interval (a,b) is one.
On 11/03/2014 04:35 PM, Emmanouil Ioannis Chaniotakis wrote:
Good afternoon,
I wish to generate random nrs distributed as P(x)= k*x^-2 with a specified mean.
How could I do that?
thanks,
Man