Truncated gamma rejection sampling with a Pareto envelope (source code)

= Truncated gamma rejection sampling with a Pareto envelope
{title2=$x_*=(\alpha+b)/\beta$}

For target density proportional to $x^{\alpha-1}e^{-\beta x}$ on $x>a>0$, use the <Pareto distribution> proposal $g(x)=ba^bx^{-b-1}$ with $b>0$. Its density ratio is proportional to $x^{\alpha+b}e^{-\beta x}$, maximized at $(\alpha+b)/\beta$ if that point exceeds $a$. The tight envelope yields the highest acceptance probability for this fixed proposal. An inverse draw is $aU^{-1/b}$ with $U$ <uniformly distributed> on $(0,1)$.