\documentclass{article}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amscd}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{eufrak}
%\numberwithin{equation}{section}

\newtheorem{theorem}{Theorem}%[section]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{remark}[theorem]{Remark}


\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{0in}
\begin{document}

\title{Law of Large Numbers\footnote{\copyright 2019 Joseph C Watkins}}
\author{Worksheet 12}
\date{}
\maketitle

\begin{enumerate}
\item Consider the function $g(x)=4\ln(2+\cos(x))/(x+4)$
\begin{enumerate}
\item Plot $g$ on the interval from 0 to 6.
\item Estimate the integral $\int_0^6g(x)\, dx$ using Monte Carlo simulations with 400 uniform random variables on the interval $[0,6]$.
\item Repeat the estimate 100 times and use this to estimate the standard deviation of the error in the integral.
\item Find the mean of these 100 simulations. This is a single Monte Carlo simulation based on 40,000 uniform random variables. Use part (c) to give an estimate of the standard deviation of the  simulation based on 40,000 uniform random variables
\item Use the {\tt integrate} command to compute numerically the integral.
\item Using your estimate for the standard deviation, discuss how close your estimate is to the numerical value. In particular, give the number of standard deviations your Monte Carlo values are from the numerical evaluation of the integral in part (e)
\end{enumerate}
\item Consider the function $g(x) = 1/\sin(\exp\sqrt{x}-1)$.
\begin{enumerate}
\item Give a plot of $g$ on the interval $(0,1]$.
\item Use simple Monte Carlo simulation to provide 100 estimates of  $\int_0^1 g(x)\ dx$ based on a sample of 200 uniform random variables. Find the mean and standard deviation of these simulations.
\item Check that 
$$f_X(x) = \left\{\begin{array}{cc}
\frac{1}{2\sqrt{x}},\quad &0\le x \le 1,\\
0&\hbox{otherwise}
\end{array}\right.$$
is a valid density function.
\item Find the distribution function and the probability transform.
\item What is the weight function? 
\item Use importance sampling to provide 100 estimates of  $\int_0^1g(x)\ dx$ based on  a sample of 200 random variables with proposal density $f_X$.  Find the mean and standard deviation of these simulations.
\item Find the ratio of the standard deviations and the variances of these two estimates. Which method does better?
\end{enumerate}
\end{enumerate}

\end{document}