\documentclass[twocolumn]{article} 
% \documentclass{article}

\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{0.0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{7.0in}
\setlength{\textheight}{9.5in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.05in}
\setlength{\columnseprule}{0.3pt}

\setlength\columnsep{25pt}

\usepackage{fancyvrb}
\usepackage{relsize}
\usepackage{hyperref}

\usepackage{listings}
\usepackage{amsmath}

\begin{document}

\lstset{xleftmargin=5mm,framexleftmargin=10mm,basicstyle=\footnotesize}

Name: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

Directions: MAKE SURE TO COPY YOUR ANSWERS TO A SEPARATE SHEET FOR SENDING
ME AN ELECTRONIC COPY LATER.

{\bf 1.}  This problem concerns the parking space model, pp.66ff.  Let
$O_i$ denote the number of open spaces in the i$^{th}$ block.

\begin{itemize}

\item [(a)] (10) Find $p_D(0)$.

\item [(b)] (10) Give a loop-free R expression for $P(N <= 5)$, using one or
more of the functions on p.66.

\item [(c)] (10) Give a loop-free R expression for $P_{O_2}(3)$.

\item [(d)] (15) Give a loop-free R expression vor $Var(O_1 - O_2)$.

\item [(e)] (10) Give a loop-free R expression vor $Var(|O_1 - O_2|)$.

\item [(f)] (15) Give a loop-free R statement to place between lines 5 and 6
in the code on p.67 that will print the approximate value of
$E(1/(1+D^2))$.

\end{itemize}

{\bf 2.} (15) Give a single, loop-free R statement to replace lines 9-10 in
the ALOHA network model on p.57, making use of one of the functions
introduced in Chapter 3.  Think of the notebook!

{\bf 3.} (15) In the bus ridership model, first introduced in Sec. 2.11, find
$P(L_3 = 5 | L_2 = 8 \textrm{ and } B_3 = 1)$.

\onecolumn

\newpage

{\bf Solutions:}

{\bf 1a.} $p_D(0) = P(D = 0) =  P(N = 11) = (1-0.15)^{10} 0.15$

{\bf 1b.} \lstinline{pgeom(5,0.15)}

{\bf 1c.} \lstinline{dbinom(3,10,0.5}

{\bf 1d.} $Var(O_1 - O_2) = Var(O_1) + Var(O_2) = 2 \cdot 10 \cdot 
0.15(1-0.15)$

{\bf 1e.} Same as (d); see definition of Var().

{\bf 1f.} \lstinline{mean(1/(1+dvals^2))}

{\bf 2.} \lstinline{rbinom(1,2,p)}

{\bf 3.} \lstinline{dbinom(4,8,0.2)}

\end{document}

