# Random Number Generation

Printable View

• Apr 27th 2009, 01:50 PM
mistykz
Random Number Generation
So, the question is to describe a process, using the accept-reject algorithm, that generates values of x with the given distributions, assuming that we can only generate a uniform number

The one I'm stuck on is x~f(x) proportional to (1+(x^2)/5)^(-3) for 0 =< x =< 4
I took the derivative, set it equal to zero, but when I solved for x I found that it was the sqrt(-1/5), which I'm pretty sure is incorrect. Does anyone know how I could fix this? Plugging that value back into the original equation does indeed yield a number, but I'm fairly certain I shouldn't be using complex values...

Thanks!
• Apr 29th 2009, 12:13 AM
CaptainBlack
Quote:

Originally Posted by mistykz
So, the question is to describe a process, using the accept-reject algorithm, that generates values of x with the given distributions, assuming that we can only generate a uniform number

The one I'm stuck on is x~f(x) proportional to (1+(x^2)/5)^(-3) for 0 =< x =< 4
I took the derivative, set it equal to zero, but when I solved for x I found that it was the sqrt(-1/5), which I'm pretty sure is incorrect. Does anyone know how I could fix this? Plugging that value back into the original equation does indeed yield a number, but I'm fairly certain I shouldn't be using complex values...

Thanks!

You are required to use the acceptance-rejection sampling method. You do this by generating two uniform RV $x\sim U(0,4),~ y\sim U(0,\text{max}_{x \in [0,4]}(f(x))$. Then $x$ is accepted if $y and rejected otherwise.

CB