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: Wed, 18 Jun 2008 20:55:12 +0200

hi,
Thanks again for taking pain in trying to help me. I have understood the matter 
with poisson distribution. I had not chosen a good example. as I had just 
written to Martin, The problem is not just dealing with a specific 
distribution. I am interested in all distributions from which I can sample 
within a range (min, max). And I still would like to know if the solution f(r) 
= a + (b - a) * r would work for any distribution returning a double or it 
should be the output of a generator from a uniform distribution?

thanks again,
Mohd

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


> Hello,
> 
> I think gsl_ran_poisson (const gsl_rng * r, double mu) returns the 'k'  
> number (i.e. then number of occurrences associated with that  
> probability generated by 'r'). This is an educated guess based on the  
> fact that p(k,lambda) and you is entering p() and lambda into the  
> above function.
> 
> You want to sample the poisson distribution in a given range of what?  
> Do you have a lambda and a k value? Or do you just have a lambda?
> 
> Cheers,
> 
> Dan/
> 
> On 17 Jun 2008, at 17:44, Mohammad Khaleghi wrote:
> 
> > 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
> >
> 
> 


_______________________________________________________________________
Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220





reply via email to

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