Generate 10 i.i.d copies of a random variable having the p.d.f.
$f(x)=$$\sum_{n=1}^\infty 2xe^{-x^2/n}1/2^n1/n$
where from what I have found so far
$F(X|N=n)=2^{-n}$
Here's the code I have so far
n5=10
u=runif(n5,0,1)
n=ceiling(1/-log(u))
x=2^n*u
Generate 10 i.i.d copies of a random variable having the p.d.f.
$f(x)=$$\sum_{n=1}^\infty 2xe^{-x^2/n}1/2^n1/n$
where from what I have found so far
$F(X|N=n)=2^{-n}$
Here's the code I have so far
n5=10
u=runif(n5,0,1)
n=ceiling(1/-log(u))
x=2^n*u
Copyright © 2021 JogjaFile Inc.