Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.9K Views
|
5 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Generating random numbers from given continuous distribution

Posted 5 years ago
POSTED BY: elena max
5 Replies
Posted 5 years ago

Thank you very much, I still have a lot of practice to do.

POSTED BY: elena max
Posted 5 years ago

Thanks a lot. Just a question, does this work on Mathematica 10? Because I can make it work on the web version of Mathematica, but not on my laptop, where I have v10.enter image description here

POSTED BY: elena max
Posted 5 years ago

For what I can see the option Method->Normalize was introduced in version 10.2

POSTED BY: Hans Milton
Posted 5 years ago

For a distribution of this form you can compute the normalization factor.

factor = NIntegrate[0.001257*x^4 Exp[-0.285714*x], {x, 0, Infinity}];
dist = ProbabilityDistribution[ 0.001257*x^4 Exp[-0.285714*x] / factor , {x, 0, 60}]
POSTED BY: Rohit Namjoshi
Posted 5 years ago

Hi Elena,

You need to normalize the distribution so its integral is 1.

    dist = ProbabilityDistribution[
      0.001257*x^4 Exp[-0.285714*x],
      {x, 0, 60},
      Method -> "Normalize"]

    RandomVariate[dist, 15]
(*
{27.4943,16.8757,5.30406,6.00207,11.8668,28.2957,21.9066,19.6846,12.266,18.8735,19.3128,
15.404,21.1927,13.8153,19.9035}
*)
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard