---
title: "R Problem due Thursday 12/6"
author: "YOUR NAME"
output: pdf_document
---

Acknowledgements: ADD NAMES HERE IF ANYONE ASSISTED YOU.  

**Email knitted pdf file to tleise@amherst.edu by 4pm on the due date.**

## Read problem 9.9 parts a and b. 

Our goal is to show how to solve two similar integrals using Monte Carlo integration. The integrands are the same in both parts but the bounds of integration differ. For each part of the problem, describe HOW to solve the integral using Monte Carlo integration (to show you understand the process), then write code and solve the integrals, and finally use the integrate function to check your approximation. 

Your solution for each part should include:

+ a sentence or two discussing the setup (what distribution to use, its density function, and how you will use a simulation to estimate the integral);
+ your R code with the simulation to estimate the integral;
+ your R code to directly estimate the integral using the integrate command;
+ a sentence comparing these two estimates.

Be sure your code is reproducible by setting seeds.

a. Integrate $\sin{x}e^{-x^2}$ from 0 to 1. 


b. Integrate $\sin{x}e^{-x^2}$ from 0 to infinity. 

*Acknowledgement: Thank you to Prof Amy Wagaman for sharing this R problem for STAT 360.*
