I want to solve the integral
$$I =\int_{0}^{3} \frac{\exp(-s)}{1+\frac {1}{s}} \text{d}s $$
using importance sampling.
I'm unsure as to how implement it.
I have sampled random variables from an exponential distribution.
$$ x = -\log(1-U)\ \text{with}\ U \sim \mathcal{U}(0,1) $$
Am I right in thinking that
$$ \hat{I} = \frac{1}{N}\sum f(x)/g(x) $$
is a proper importance sampling approximation, where $$f(s)=\frac{\exp(-s)}{1+\frac {1}{s}}$$
and $g$ is the pdf of the standard exponential distribution.