% Simplified version of an UMTYMP template.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% If the text is too small, change 10pt to 12pt
\documentclass[11pt]{article}
\RequirePackage{amsmath,amsthm,amssymb,latexsym,amsthm,verbatim,xspace,amstext,xspace,setspace}

% Here's where you edit the class, section and title information

% Set a fixed margin along all sides
\usepackage[margin=1.2in, nohead, pdftex]{geometry}
\usepackage{enumerate,graphicx}
% Re-adjust the top margin if desired
\topmargin -0.2in
% These packages used for spacing in the header and throughout



% Uncomment one of the following to set the spacing to single, 1.5 or double spacing
\singlespacing
%\onehalfspacing
%\doublespacing

% This prevents paragraphs from begin indented.  Comment it out to have indentation.
\parindent 0ex
\setlength{\textheight}{9.5in}

\newcounter{num}
% Finally we start!
\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is the "header" at the top.  You shouldn't have to edit these lines!
% Instead, chance the Class, Section and Title above.
\begin{center}{ \Large{Lab worksheet}  \\\large{10/10/2017} }\end{center}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% At this point, you might have some introductory text, or jump straight
% into an ``enumerate'' environment for the problem statements.
\bigskip
There are several ways to visualize a 2-dimensional or 3-dimensional region in Mathematica. Some helpful commands are \emph{Plot(3D)}, \emph{ContourPlot(3D)}, and \emph{RegionPlot(3D)}. Let's first consider how to sketch a 2-dimensional region (Problem 1 and 2).
\begin{enumerate}
\item Visualize $R=\{(x,y):a\le x\le b,~f(x)\le y\le g(x)\}$:\begin{center}Plot[\{f(x), g(x)\}, \{x, a, b\}, Filling$\to$\{1$\to$\{2\}\}, PlotLegends$\to$''Expressions'']\end{center}
The part ``1$\to$\{2\}'' means to fill the region from the graph of f(x) (the \emph{first} function) to the graph of g(x) (the \emph{second} function). The ``PlotLegends'' part is optional, specifying on the plot which curve is of which function.

\textbf{Practice}
\begin{enumerate}
\item Visualize $R=\{(x,y):0\le x\le 1, ~x^2\le y\le x\}$.\vspace{1.2in}
\item Visualize $R=\{(x,y):0\le x\le 1, ~0\le y\le 1\}$.
\vspace{1.2in}
\item Visualize $R=\{(x,y):0\le y\le 1, ~0\le x\le 2-y\}$.
\vspace{1.2in}
\end{enumerate}
\item When $R$ is described not as explicitly as in Part 1, we can use the command \emph{RegionPlot}. For example, if $R$ is a domain inside the circle $x^2+y^2=9$ and outside the circle $(x-1)^2+(y+1)^2=1$, we can write $R$ as $R=\{(x,y):x^2+y^2=9,~(x-1)^2+(y+1)^2=1\}$. Command:
\begin{center}RegionPlot[$x^2+y^2\le 9$ \&\& $(x-1)^2+(y+1)^2\ge 1$,~\{x,~-3,~3\},~\{y,~-3,~3\}]\end{center}
\textbf{Practice}
\begin{enumerate}
\item Sketch the region in the first quadrant, under the line $y=2-x$.\vspace{1.2in}
\item Sketch the region inside the ellipse $\dfrac{x^2}{4}+(y-2)^2=1$, on the right of the line $x=1$.
\vspace{1.2in}
\end{enumerate}
\setcounter{num}{\value{enumi}}
\end{enumerate}
For visualizing a 3-dimensional region, the color effects become more important. Let's consider some examples (Problem 3 and 4).
\begin{enumerate}\setcounter{enumi}{\value{num}}
\item Visualize $R=\{(x,y,z):a\le x\le b,~f(x)\le y\le g(x),~h(x,y)\le z\le k(x,y)\}$:\begin{center}RegionPlot3D[$a\le x\le b~\&\& ~f(x)\le y\le g(x)~ \&\&~h(x,y)\le z\le k(x,y) $, PlotStyle$\to$Opacity[0.5], Mesh$\to$None]\end{center}
\textbf{Practice}
\begin{enumerate}
\item Sketch the region in the first octant (meaning x, y, z are nonnegative), under the paraboloid $z=1-x^2-y^2$.\vspace{1.2in}
\item Sketch the region inside the ellipsoid $\dfrac{x^2}{4}+y^2+z^2=1$, above the plane $x+y+z=0$.
\vspace{1.2in}
\item Sketch the region for the integral\[\int_{0}^{1}{\int_{0}^{2x}{\int_{{{x}^{2}}+{{y}^{2}}}^{x+y}{f(x,y,z)dzdydx}}}\]
\vspace{1.2in}
\end{enumerate}
\item Sometimes a 3D region is best visualized by plotting all surfaces (that form it) at once. For example, when $R$ is the region cut out of the ball $x^2+y^2+z^2\le 4$ by the cylinder $x^2+z^2=1$:
\begin{center}ContourPlot3D[\{$x^2+y^2+z^2==4$, $2 x^2+z^2==1$\}, \{x,-2,2\},~\{y,-2,2\},~\{z, -2, 2\}, ContourStyle$\to$Opacity[0.5], Mesh$\to$None]\end{center}
\textbf{Practice}
\begin{enumerate}
\item Visualize the region between the cone $z=\sqrt{x^2+y^2}$ and the paraboloid $z=x^2+y^2$.\vspace{1.2in}
\item Visualize the region bounded by $z=0$, $z=\pi$, $y=0$, $y=1$, $x=0$ and $x+y=1$.
\vspace{1.2in}
\end{enumerate}
\setcounter{num}{\value{enumi}}
\end{enumerate}
There are several ways to compute a double/triple integral in Mathematica (Problem 5 and 6). \begin{enumerate}\setcounter{enumi}{\value{num}}
\item One way is to use do an iterated integral, which involves writing the domain in such a way that we can take integral with respect to each variable, one by one. For example, to compute the integral given by Part (c) of Problem 3, we execute
\begin{center}Integrate[f(x, y, z),\{x, 0, 1\}, \{y, 0, 2x\} ,\{z, $x^2+y^2$, x+y\}]\end{center}
\textbf{Practice}
\begin{enumerate}
\item Compute\[\int_{0}^{1}{\int_{-x}^{x}{\int_{-x+y}^{x+y}{({{x}^{2}}+zy)dzdydx}}}\]\vspace{1.2in}
\item Compute the volume of the region in Part (a) of Problem 4.\vspace{1.2in}
\end{enumerate}
\item Another way is to \emph{define the region of integration}. Then let Mathematica compute the double/triple integral. For example, the region the region $R$ at the beginning of Problem 3 can be defined in Mathematica as
\begin{center}R = ImplicitRegion[$a\le x\le b$ \&\& $f(x)\le y\le g(x)$ \&\& $h(x,y)\le z\le k(x,y)$, \{x, y, z\}]\end{center}
Then the integral \[\iiint\limits_{R}{u(x,y,z)dV}\]
is evaluated via the command \begin{center}Integrate[u(x, y, z), \{x, y, z\}$\in$R]\end{center}
The symbol ``$\in$'' can be typed as ESC el ESC.\\\\
\textbf{Practice}
\begin{enumerate}
\item Compute the volume of the region in Part (b) of Problem 3.\vspace{1.2in}
\item Compute the area of the region in Part (b) of Problem 2.\vspace{1.2in}
\end{enumerate}
\end{enumerate}
\end{document}











