I need to apply the Monte Carlo integration to estimate the following function in [0,1]:
f(x) = exp(-ax) cos(bx)
where a=0.3060734 and b=0.11221230.
But, I need to use four different Monte Carlo variations: hit or miss, crude, importance sampling and variance control. All of them are on page 392 from this book:https://edisciplinas.usp.br/pluginfile.php/5168099/mod_resource/content/1/Julio%20Stern.pdf.
However, after estimating the integral of f(x) in each variation, I need to calculate the relative error ( | g* - g | / g ) < 1%
where g is the real value of the integral (unknown) and g* is the estimated value. How do I calculate the error? I thought about using the variance of each variation, but I am not sure about how to do that and make it < 1%.
I already have the code calculating each estimation and variance.
OBS: I am supposed to use Python or R.