Can someone help me with the below question. I'm stuck on part d. I understand with the rejection method I have to use a known density g(x) along with my f(x). What do I use for my g(x). I'm confused where to begin

Consider the (triangular) probability density function defined as

f(x) = 4x; 0 <= x <= 1/2

4 - 4x; 1/2 <= x <= 1

(a) Draw plots of the density and of the CDF.

(b) Use the Inverse CDF method to analytically find a function G(u) that transforms

random numbers from U(0; 1) distribution into random numbers from f(x).

(c) Use part (b) to generate 1000 data points from f(x) and plot their histogram.

(d) Use rejection sampling to generate 1000 data points from f(x) and plot their histogram.

What instrumental distribution and envelope did you use?

(e) Use the Monte Carlo method to estimate E[X2] when X is drawn from the distribution

with density f and compare your estimate to the actual value. You may use the data

generated in (c) or (d) for your estimation.

### Recently Asked Questions

- A vessel initially contains pure A at a pressure of 1.0 bar. The total pressure of all gases at equilibrium is 1.5 bar. What is K for this reaction? A

- For the formula: acridinium + Iaq) + H 2 0 (l) -> acridine (aq) + H 3 O + (aq) where delta S is -18J/mol/K

- Consider the following equilibrium: C(s) + CO 2 (g) + 2 Cl 2 (g) ↔ 2 COCl 2 (g) Choose the TRUE statements from among the following: i) The equilibrium