[1] 0.6315141
[1] 0.6321206
Chapter 6 - Monte Carlo Integration and Variance Reduction
Marquette University
MATH 4750 - Spring 2025
# Compare the original function with the importance sampling function
curve(g, from = -3, to = 3, col = "blue", lwd = 2, main="Importance Sampling: g(x) vs f(x)")
curve(f, add = TRUE, col = "red", lty = 2, lwd = 2)
legend("topright", legend=c("g(x)", "f(x)"), col=c("blue", "red"), lty=c(1, 2), lwd=2)