RANDOM-EXPONENTIAL

Dr Deepak Shah shared this question 1 month ago
Answered

Geogebra has a RandomNormal function - which will deliver a randon sample from any normal distribution. It has the same function for other distributions...

BUT: It doesn't have a RandomExponential function: So how can I generate a list (of size N), which is a random sample from X ~ Exponential(λ)?

Thanks in advance to any boffins that can provide an answer...

Comments (4)

photo
1

Looking at https://stackoverflow.com/q... , maybe this is what you want:


-ln(1 - random())

photo
1

so then maybe this (if the above is correct)

Sequence(-λ ln(1 - random()), i, 1, 1000)

photo
1

Wow! Such a quick answer - BIG thanks!

I've tried it - and it works, but I can't tell if it works properly or not: I seem to be getting a lot of very small values (near x=0) (if I ask for 2 random numbers from the distribution, one is almost always zero...) I mean, the Expnoential distribution does have a mode of zero, but it still appears to be giving smaller answers than I'd expect...

The probabilities os getting a number smaller than i is given by: P(X < i) = 1 – e^(–λi)The probability of getting a number bigger than i is: p(X > i) = e^(–λi)

SO, I should be able to check if that's working properly or not: But I don't really understand the "syntax" (or even how Geogebra gets the numbers). Is it too much to ask if you can check it for me???

photo
1

Oh - No worries - I figure it out! Thanks again Michael: I'd have bee nstruck on this for 100 hours (and still not got there) without your help. I bow to you !

© 2021 International GeoGebra Institute