Hi All,
I'm trying to create a histogram filled with random numbers generated from
a function, which is a piecewise function. Now how do you define the
intervals that seperate the piecewise functions?
Example. Say I have two gaussian funcions (1/7)*exp(-((x-2)/5)^2) and
(1/5)*exp(-((x-4)/5)^2) that I want to piece together from [0,10] and
[10,20] respectively. How is this then stated in the following histogram
declaration?
Double_t* data;
TF1 *f1 = new TF1("f1", "(1/7)*exp(-((x-2)/5)^2) +
(1/5)*exp(-((x-4)/5)^2)", 0, 2000);
for (i = 0; i < 1000000; i++) {
data = f1->GetRandom();
h1->Fill(data[8],1);
}
Thanks!
Erik Jakobsen
P.S. I'm not on the ROOT Talk list, so please answer to jakobsen@nbi.dk
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:50 MET