Re: Sampling from a generic distribution

From: Finetti Noemi <noemi.finetti@aquila.infn.it>
Date: Tue May 20 2008 - 14:19:28 CEST

Dear Giuseppe,
thank you very much for your advice, I gave a look at the material of
the last FLUKA course at Laboratori Nazionali di Legnaro (MCstat.pdf)
and I implemented in my source subroutine the following simple algorithm
for sampling from a generic distribution:
c-----------------
5 CONTINUE
XIII = emin+(emax-emin)*FLRNDM(XIIIDUMMY)
YFUNC=fu(XIII)
YIII = fumin+(fumax-fumin)*FLRNDM(YIIIDUMMY)
IF(YIII.gt.YFUNC) GO TO 5
kk=kk+1
SAMPLE = XIII
c-----------------
where fu is a generic function declared external, fumax and fumin are
the maximum and the minimum value of the fuction fu (corresponding to
energy emax and emin respectively). It seams to work properly!
Unfortunately I cannot attend the next FLUKA course at Cern, but I hope
to attend one of the next FLUKA courses.
Kind regards,
noemi

Giuseppe Battistoni wrote:

>Dear Noemi,
>it could be useful for you to study the material of the last
>FLUKA course (see http://www.fluka.org/course/Legnaro-07/Lectures/)
>
>For your last questions please give a look at MCstat.pdf
>and the last part of UserRoutines.pdf where some useful additional
>routines of FLUKA are mentioned.
>
>P.S.: did you consider the opportunity of attending one of the next
>FLUKA couuses?
>
> Giuseppe
>
>
>
>
>

-- 
* Address: Dott.ssa Noemi Finetti
  c/o Dipartimento di Fisica dell'Universita' degli Studi dell'Aquila
  Via Vetoio - 67010 Coppito - L'Aquila - Italy
* Phone: +39-0862-433051 (Office); +39-0862-433043 (Laboratory)
  
* Fax: +39-0862-433033 (Department).
Received on Tue May 20 14:59:56 2008

This archive was generated by hypermail 2.1.8 : Tue May 20 2008 - 14:59:58 CEST