\documentclass[12pt,oneside]{amsart}
\usepackage{amsmath,amssymb,verbatim,setspace,geometry}
\geometry{top=1in,bottom=1in,includeheadfoot}
\doublespacing

\begin{document}
\noindent MTH 154 \hfill Numerical Integration \hfill Spring 08

\noindent
Prof. Cowen
\vskip 18 pt
\section {Numerical Integration} 

The goal of this section is to give a numerical approximation to 
$\int_{a}^{b} f(x) \, dx$, where $f(x)$ is a continuous function. 
We chop the interval $[a, b]$ into $n$ equal pieces and use the following 
notation:

\begin{alignat}{2} \notag
    h &= \frac {b - a}{n} & &\quad\text {Width of the intervals}\\
    x_{0} &= a, \,x_{1} = a + h, \,x_{2} = a + 2h, \ldots, \,x_{n} = b & &\quad\text
{Endpoints} \notag \\
    \bar x_{0} &= a + \frac{h}{2}, \,\bar x_{1} = \bar x_{0} + h, 
    \,\bar x_{2} = \bar x_{0} + 2h,\ldots, 
    \,\bar x_{n} = \bar x_{0} + nh & &\quad\text
{Midpoints} \notag \\
    y_{0} &= f(x_{0}), \ldots, y_{n} = f(x_{n}) & &\quad\text {$y$ 
    values endpts} \notag \\
    \bar y_{0} &= f(\bar x_{0}), \ldots, \bar y_{n} = f(\bar x_{n}) & &\quad\text {$y$ 
    values midpts} \notag \\
    \operatorname{Left}_{n} &= h \cdot \left(y_{0} + \ldots y_{n-1}\right) &
&\quad\text 
    {Left endpoint rule} \notag  \\
    \operatorname{Right}_{n} &= h \cdot \left(y_{1} + \ldots y_{n}\right) &
&\quad\text 
    {Right endpoint rule} \notag  \\
    \operatorname{Mid}_{n} &= h \cdot \left(\bar y_{1} + \ldots \bar y_{n}\right) &
&\quad\text 
    {Midpoint rule} \notag \\
    \operatorname{Trap}_{n} &= \frac {h}{2} \cdot \left(y_{0} + 2 
    y_{1} + \ldots 2y_{n-1} + y_{n}\right) &
&\quad\text 
    {Trapezoidal rule} \notag  \\
    \operatorname{Simp}_{n} &= \frac {h}{3} \cdot \left(y_{0} + 4 
    y_{1} + 2y_{2} + \ldots 2y_{n-2} + 4y_{n-1} + y_{n}\right) &
&\quad\text 
    {Simpson's rule; $n$ is even} \notag 
\end{alignat}
\newpage

\section {Error Bounds}

In this section we give estimates on the error given by approximating 
the integral $\int_{a}^{b} f(x) \, dx$ by the various numerical 
methods. The errors are defined as follows:

\begin{alignat}{2} \notag
    \operatorname{LeftError}_{n} &= \left| \int_{a}^{b} f(x) \, dx - 
     \operatorname{Left}_{n} \right| & &
     \quad\text {Left error} \notag  \\
    \operatorname{RightError}_{n} &= \left| \int_{a}^{b} f(x) \, dx - 
     \operatorname{Right}_{n} \right| & &
     \quad\text {Right error} \notag  \\
    \operatorname{MidError}_{n} &= \left| \int_{a}^{b} f(x) \, dx - 
     \operatorname{Mid}_{n} \right| & &
     \quad\text {Midpoint error} \notag  \\
    \operatorname{TrapError}_{n} &= \left| \int_{a}^{b} f(x) \, dx - 
     \operatorname{Trap}_{n} \right| & &
     \quad\text {Trapezoidal error} \notag  \\
    \operatorname{SimpError}_{n} &= \left| \int_{a}^{b} f(x) \, dx - 
     \operatorname{Simp}_{n} \right| & &
     \quad\text {Simpson error} \notag
\end{alignat}

\noindent Note that by definition the errors are always positive; we do not
distinguish between overestimates and underestimates in the error.

Assume that we can find constants $M_{1}, M_{2}, \text { and } M_{4}$ so that $\left| 
f'(x) \right| \le M_{1}, \left| f''(x) \right| \le M_{2}, \text { and }
\left| f^{(4)}(x) \right| \le M_{4}$ on $[a, b]$. Then we have the following error 
bounds:

\begin{alignat}{2} \notag
    \operatorname{LeftError}_{n} &\le \frac{M_{1} \, (b - a) \, h}{2} & &
     \quad\text {Left error bound} \notag  \\
    \operatorname{RightError}_{n} &\le \frac{M_{1} \, (b - a) \, h}{2} & &
     \quad\text {Right error bound} \notag  \\
    \operatorname{MidError}_{n} &\le \frac{M_{2} \, (b - a) \, 
    h^{2}}{24} & &
     \quad\text {Midpoint error bound} \notag  \\
    \operatorname{TrapError}_{n} &\le \frac{M_{2} \, (b - a) \, h^{2}}{12} & &
     \quad\text {Trapezoid error bound} \notag  \\
    \operatorname{SimpError}_{n} &\le \frac{M_{4} \, (b - a) \, 
    h^{4}}{180} & &
     \quad\text {Simpson error bound} \notag
\end{alignat}
\newpage

\section{Problems}

\noindent Problems from Calculus, 2nd edition, by Hunt;
Calculus with Early Transcendentals, 4th edition, by Stewart; and Calculus
with Analytic Geometry, Early Transcendentals, 5th edition, by Edwards \&
Penney. 
\vskip 12 pt


\noindent 1.  Use the Trapezoidal Rule and the Midpoint Rule to
approximate $\int_{0}^{2} e^{-x^{2}} \, dx$ using $n = 10$.  Estimate
(that is, find bounds on) the errors $\operatorname{TrapError_{10}}$
and $\operatorname{MidError_{10}}$.  How large do we have to take $n$
so that we could guarantee that the errors in using the Trapezoidal
Rule and the Midpoint Rule would be less than 0.000001?  
\vskip 12 pt

\noindent 2.  Use Simpson's Rule to
approximate $\int_{1}^{2}\frac {dx} {x}$ using $n = 10$.  Estimate 
the error $\operatorname{SimpError_{10}}$. How large do we have to take $n$ so 
that we could guarantee the error in using Simpson's Rule 
would be less than 0.000001? (This would be a practical way to 
calculate $\ln 2$.)
\vskip 12 pt

\noindent 3.  Because the number $e$ is the base for natural logarithms, it
follows that
\[
\int_{1}^{e} \frac {1}{x} \, dx = 1.
\]
Use numerical integration to approximate the integrals $\int_{1}^{2.7}
\frac {1}{x} \, dx$ and $\int_{1}^{2.8}\frac {1}{x} \, dx$ with
sufficient accuracy to show that $2.7 < e < 2.8$.  
\vskip 12 pt

\noindent 4.  Use the Trapezoidal Rule to approximate $\int_{0}^{20} 
\cos(\pi x) \, dx$ using $n = 10$. Find the exact error 
$\operatorname{TrapError}_{10}$. Explain why the error is so big.
\vskip 12 pt

\noindent 5.   Let $f(x)$ be a continuous function on $[a,b]$. The 
{\em average value \/} of $f$ is defined to be
\[
\frac {1}{b -a} \int_{a}^{b} f(x) \, dx.
\]
Show that if we approximate $\int_{a}^{b} f(x) \, dx$ by the 
Trapezoidal Rule, then the average value of $f$ is approximated by
the average of $y_{1}, y_{2}, \ldots, y_{n-1}, \frac {y_{0} + y_{n}} {2}$.
\vskip 12 pt

\noindent 6.  Prove that if $L(x) = Ax + B$ is a linear function, then
both the Trapezoidal Rule and the Midpoint Rule give the exact answer
for $\int_{a}^{b} L(x) \, dx$.  (Hint: what is the bound on the error?)  
\vskip 12 pt

\noindent 7.   Prove that if $P(x)$ is a polynomial of degree 3, then 
Simpson's rule gives the exact answer for $\int_{a}^{b} P(x) \, dx$. 
(Hint: what is the bound on the error?)
\vskip 12 pt

\noindent 8.  Let $f(x)$ be continuous and positive on $[a, b]$.  If
$f''(x) > 0$ for all $x$ in $[a, b]$, prove that $\operatorname{Mid}(n) \le
\int_{a}^{b} f(x) \, dx$. (Hint: it suffices to prove this result for 
$n = 1$. Why is that?)

\vskip 12 pt


\end{document}