%Approximate Double Integrals
%Math263D

\documentclass[12pt]{article}
\usepackage{times}
\pagestyle{empty}

\addtolength{\textwidth}{1.2in}
\addtolength{\textheight}{1.2in}
\addtolength{\oddsidemargin}{-.58in}
\addtolength{\evensidemargin}{-.58in}
\renewcommand{\baselinestretch}{1.0}
\parindent = 0cm
\parskip = .1cm

\begin{document}

\begin{center}
{\Large
Approximate Double Integrals\footnote{
Copyright \copyright 2002 Todd Young.
All rights reserved. Please address comments to young@math.ohiou.edu.}}
\end{center}

\begin{enumerate}
 \item Go to the O.U. \textsc{MatLab} website (\verb&www.math.ohiou.edu/~matlab&).
       In 263D, under this assignment, click on: \verb&lowerleft.m&\\
       This will download a program file; save it to your working directory.

\item Open \textsc{MatLab}. In the command window, check the current directory, and
      if needed, change to the directory where you saved \verb&lowerleft.m&.

\item In the command window, type the following commands:\\
        \verb&   format long&\\
        \verb&   f = inline('x*y^2', 'x', 'y')&\\
        \verb&   lowerleft(f, 0, 1, 0, 2, 10, 20)&\\
\textsc{MatLab} should return the answer \verb&1.1115000000000&. Calculate the integral
exactly by hand and find the \% error.


\item Click on the file icon at the upper left corner and open the file
      \verb&lowerleft.m&, this will be the program that was used in the
      command above by the same name. Read the program and comments.

\item Save the program as \verb&centerpoint.m&. Modify it to do Riemann
      sums using the centerpoint rather than the lowerleft point. You will
      need to change the name of the function in the first line to \verb&centerpoint&,
      otherwise, you will need to change very little.

\item Test your new program on $f(x, y) = xy^2$ by typing:\\
         \verb&   centerpoint(f, 0, 1, 0, 2, 10, 20)&\\
      This answer should be closer to the correct answer than \verb&lowerleft&. 
      Test this using the \% error.

\item Try out your new program on the following integral:
$$
      \int_0^2\int_0^5\sqrt{xy + y^5 + x^2} dydx
$$
Also, try this integral using the command \verb& dblquad & as in the previous
homework. For \verb&m& and \verb&n& fairly large, does your program come close to
\textsc{MatLab}'s built in program?


\item Using complete sentences and standard mathematical notation, write a brief report.
\end{enumerate}

\vfill

\noindent
\textsf{This assignment gives students a chance to work with Riemann sums and
        gives a very gentle introduction to programming in \textsc{MatLab}.}

\end{document}

