

\subsection{\bf (iii) Example of Weighted Histograms}

\begin{slide}
\begin{itemize}
\item Consider a histogram in which $N$ events with
weight $w_i (i=1 \ldots N)$ and $x$-value $x_i$ fall.  

\item This occurs in Monte Carlo calculation of $\frac{{\displaystyle 
\int\limits} x\, w(x) dx}{{\displaystyle \int\limits} w(x) dx}$.
\[
\langle x\rangle = \frac{{\displaystyle \sum^N_{i=1}} w_i\, x_i = 
S_3}{{\displaystyle \sum^N_{i=1}} w_i = S_1}
\]

\item with $f=wx$, $g=w$.  

\item The error in this calculation is
\begin{eqnarray*}
\sigma & = & \frac{S_3}{S_1} \sqrt{\frac{1}{N} \left\langle \left(
\frac{Nwx}{S_3} - \frac{Nw}{S_1} \right)^2 \right\rangle} \\
\sigma^2 & = & \frac{S^2_3}{S^2_1}\, N \left\langle \left\lbrack
\frac{w^2 x^2}{S^2_3} - \frac{2w^2 x}{S_3 S_1} + \frac{w^2}{S^2_1}
\right\rbrack \right\rangle \\
& = & \frac{1}{S^2_1} \left\lbrack S_6 - 2\langle x\rangle S_4 +
\langle x\rangle^2 S_2 \right\rbrack \\
S_2 & = & \sum^N_{i=1} w_i^2 \\
S_4 & = & \sum^N_{i=1} w_i^2\, x_i \\
S_6 & = & \sum^N_{i=1} w_i^2\, x_i^2
\end{eqnarray*}
\end{itemize}
\end{slide}

