Solution (source code)

= Solution

For $x\ne0$, the envelope ratio is
$$
\frac{p(x)}{q(x)}=\frac32(1+x^2)\left(\frac{\sin x}x\right)^4.
$$
If $|x|\le1$, use $|\sin x|\le|x|$ to bound this by $\tfrac32(1+x^2)\le3$. If $|x|\ge1$, use $|\sin x|\le1$ to bound it by $\tfrac32(x^{-4}+x^{-2})\le3$. The boundary equalities in these bounds cannot both occur in the sine estimate, so $M=3$ is a valid envelope. At zero the <continuous> ratio is $3/2$.

Generate <independent> <Cauchy sequence>[Cauchy] proposals as in (i), together with <independent> uniform $U$. Accept a proposal $Y$ when
$$
\boxed{U\le\tfrac12(1+Y^2)\left(\frac{\sin Y}{Y}\right)^4,}
$$
using the limiting value $1/2$ at $Y=0$. Repeat until acceptance. Part (a) proves exactness; the overall acceptance rate is $1/3$ and the mean number of proposals is three. No numerical maximization of the ratio is needed for correctness.