PDA

View Full Version : a problem !!!

beardgh
12-22-2009, 07:03 PM
hello ,veryone!
I have a problem with number generator of IMSL 5.0 for C#.
How can I find random number for Beta distribution ? "nextbeta()" get random number which the "x" btween 0 and 1,but what about "x" btween 0 and 50
Which function should I use and how?
eagerly Regards

ed
12-22-2009, 08:17 PM
Since NextBeta() (http://www.vni.com/products/imsl/cSharp/imslcs600/manual/WordDocuments/api/Imsl.Stat.Random.NextBeta.html) returns (0,1) and you need that distribution on (0,50), just multiply the result by 50.

beardgh
12-22-2009, 09:21 PM
thank you for your help! ed ! what about x(a,b)[b>a]?how can i do that?

ed
12-23-2009, 07:55 AM
what about x(a,b)[b>a]? how can i do that?

I'm not sure what you're asking here -- can you clarify?

beardgh
12-23-2009, 06:10 PM
thank you ,ed!
"nextbeta()" get random number which the "x" btween 0 and 1,but what about "x" btween "a" and "b"?
Which function should I use and how?

ed
12-23-2009, 07:37 PM
I see now. To get a number in the range (a,b) from a distribution that gives you (0,1), you just need to multiply by the new range (b-a) and then add a as in:

v = NextBeta(p,q) * (b-a) + a

beardgh
12-23-2009, 08:03 PM
I began to think that this is the case：v = NextBeta(p,q) * (b-a).You helped me a lot of busy,ed.Thank you !!:)