help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Random numbers within some ranges in th e domain using di


From: Mohammad Khaleghi
Subject: Re: [Help-gsl] Random numbers within some ranges in th e domain using different distributipons?
Date: Tue, 17 Jun 2008 18:44:32 +0200

Hello Dan,

Thank you very much for the email and the explaination which is very useful. I 
might have still some problems. It is maybe due to lack of enough knowledge in 
statistics :-)
I saw that most of the functions return double. Do you mean all these are 
distributed between (0, 1)? Then your solution is in these case perfect. But 
what should I do in the cases where a long int is returned?
I copied and pasted an example from the documents, where an unsined int is 
generated. Almost the same goes for all uniform distributions.


— Function: unsigned int gsl_ran_poisson (const gsl_rng * r, double mu)
This function returns a random integer from the Poisson distribution with mean 
mu. The probability distribution for Poisson variates is,
p(k) = {\mu^k \over k!} \exp(-\mu)
for k >= 0.

Does the above means that the function produces long int values between (0, 
+inf)?
If so how can I produce (or get) say long ints between (100, 200)?
Does it make sense even thinking of something between (-100, 150)?

Thanks a lot
Mohd

> -----Ursprüngliche Nachricht-----
> Von: "Daniel J Farrell" <address@hidden>
> Gesendet: 17.06.08 18:01:50
> An: Mohammad Khaleghi <address@hidden>
> CC: address@hidden
> Betreff: Re: [Help-gsl] Random numbers within some ranges in the domain using 
> different distributipons? 


> Hello Mohd,
> 
> I think you are looking for this function:
> 
> f(r) = a + (b - a) * r
> 
> where a is the min value, b is the max values and r is a random number  
> distributed between 0 and 1 (e.g. use gsl_rng_uniform_pos() to  
> generate r).
> 
> This come up a lot on the mailing list maybe it should be added to the  
> library?
> 
> Cheers,
> 
> Dan.
> 
> 
> 
> On 17 Jun 2008, at 16:26, Mohammad Khaleghi wrote:
> 
> > Hi everybody!
> >
> > Could somebody please tell me how to generate random numbers within  
> > some ranges in the domain?
> > I saw the documentation and did not see anything like setting a min  
> > and max. I mean for a distribution that has a domain (-inf, + inf)  
> > could one set some range (min, max) to sample from? Or it is not  
> > possible with gsl?
> >
> > thans, Mohd
> >
> > _______________________________________________________________________
> > EINE FÜR ALLE: die kostenlose WEB.DE-Plattform für Freunde und Deine
> > Homepage mit eigenem Namen. Jetzt starten! http://unddu.de/? 
> > address@hidden
> >
> >
> >
> > _______________________________________________
> > Help-gsl mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/help-gsl
> 
> 


______________________________________________________________
Jeden Monat 1 hochkarätiger maxdome-Blockbuster GRATIS!
Exklusiv für alle WEB.DE Nutzer. http://www.blockbuster.web.de





reply via email to

[Prev in Thread] Current Thread [Next in Thread]