Results 1 to 7 of 7

Thread: a problem !!!

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    10

    a problem !!!

    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?
    Thanks in advance
    eagerly Regards

  2. #2
    Senior Member ed's Avatar
    Join Date
    Aug 2005
    Posts
    312
    Since NextBeta() returns (0,1) and you need that distribution on (0,50), just multiply the result by 50.


    The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.

  3. #3
    Junior Member
    Join Date
    Aug 2009
    Posts
    10
    thank you for your help! ed ! what about x(a,b)[b>a]?how can i do that?

  4. #4
    Senior Member ed's Avatar
    Join Date
    Aug 2005
    Posts
    312
    Quote Originally Posted by beardgh
    what about x(a,b)[b>a]? how can i do that?
    I'm not sure what you're asking here -- can you clarify?


    The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.

  5. #5
    Junior Member
    Join Date
    Aug 2009
    Posts
    10
    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?

  6. #6
    Senior Member ed's Avatar
    Join Date
    Aug 2005
    Posts
    312
    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


    The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.

  7. #7
    Junior Member
    Join Date
    Aug 2009
    Posts
    10
    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 !!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •