\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumerate}
\usepackage{ifthen}
\usepackage{ulem} % for strikethrough \sout{...} command
\usepackage{color}
\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{-0.5in}
\setlength{\headheight}{0.0in}
\setlength{\headsep}{0.0in}
\setlength{\topskip}{0.0in}
\setlength{\textheight}{9.5in}
\setlength{\textwidth}{7.5in}


\usepackage{tikz,pgfplots}
\usepgfplotslibrary{fillbetween}


\newcommand{\bdot}{\, {\scriptstyle{\bullet}} \,}
\newcommand{\B}[1]{{\bf {#1}}}
\newcommand{\la}{\langle}
\newcommand{\ra}{\rangle}

\newcommand{\myspace}{\parbox[c][0.2in]{0.2in}{\hfill}}
\newcommand{\varspace}[2]{\mbox{\parbox[c][#1]{#2}{\hfill}}}
\newcommand{\force}{{$\mbox{\,\!}$}}

\begin{document}

\pagestyle{empty}

\noindent
\parbox{2in}{\bf Math 2130}
\hfill {\Large \bf Test \#3} \hfill
\parbox{2in}{\bf \hfill April $16^\mathrm{th}$\!,\  2018}

\vspace{0.2in}

\noindent {\large\bf Name:} \underline{\hskip 3.0 truein}
\hfill {\bf Be sure to show your work!}

\vspace{0.05in}

\noindent
\begin{equation*}
\begin{array}{ccc}
 x & = & \rho \cos(\theta) \sin(\varphi) \\
 y & = & \rho \sin(\theta) \sin(\varphi) \\
 z & = & \rho \cos(\varphi) 
\end{array} 
\hspace*{2.5in}
\begin{array}{c}
J=\rho^2\sin(\varphi) \\
{}\\
\cos^2(\theta) = \frac{1}{2}\left(1+\cos(2\theta)\right)
\end{array}
\end{equation*}

\vspace{0.05in}

\noindent
{\bf\large 1. (12 points)} The following are plots of several vector fields. Please note that all of the vectors have been scaled down so they do not overlap each other. Write A, B, and C next to the appropriate vector field's formula. Put an X next to the formula whose vector field is {\bf not shown}. Also, for each vector field \underline{is $\B F$ conservative? Circle ``Yes'' or ``No''}.

\vspace{0.1in}

\force
\hfill
\begin{tikzpicture}[scale=0.5]
\begin{axis}[
    axis lines=middle,
    view={0}{90},
    domain=-4:4,
    y domain=-4:4,
    xmax=5, ymax=5,
    samples=6,
    color=gray
]
\addplot3 [black, quiver={u={x}, v={y}, scale arrows=0.25, every arrow/.append style={-latex}}] (x,y,0);
\end{axis}
\end{tikzpicture}
\hfill \hfill
\begin{tikzpicture}[scale=0.5]
\begin{axis}[
    axis lines=middle,
    view={0}{90},
    domain=-4:4,
    y domain=-4:4,
    xmax=5, ymax=5,
    samples=6,
    color=gray
]
\addplot3 [black, quiver={u={x}, v={-x}, scale arrows=0.25, every arrow/.append style={-latex}}] (x,y,0);
\end{axis}
\end{tikzpicture}
\hfill \hfill
\begin{tikzpicture}[scale=0.5]
\begin{axis}[
    axis lines=middle,
    view={0}{90},
    domain=-4:4,
    y domain=-4:4,
    xmax=5, ymax=5,
    samples=6,
    color=gray
]
\addplot3 [black, quiver={u={-y}, v={x}, scale arrows=0.25, every arrow/.append style={-latex}}] (x,y,0);
\end{axis}
\end{tikzpicture}
\hfill
\force

\vspace{0.1in}

\force 
\hfill
{\bf\Large A} \hfill \hfill
{\bf\Large B} \hfill \hfill
{\bf\Large C} 
\hfill
\force

\vspace{0.05in}

\force \hspace{-0.25in}
\fbox{\myspace} $\B F(x,y) = \la x, -x \ra$ \hfill
\fbox{\myspace} $\B F(x,y) = \la y, x \ra$ \hfill
\fbox{\myspace} $\B F(x,y) = \la -y, x \ra$ \hfill
\fbox{\myspace} $\B F(x,y) = \la x,y \ra$

\vspace{0.05in}

\force \qquad
Yes / No \hfill
Yes / No \hfill
Yes / No \hfill
Yes / No
\qquad \force

\vspace{0.15in}

\noindent
{\bf\large 2. (9 points)} Let  $\B F(x,y,z) = \left\la x+y^2z^3, \ y+x^5z, \  \sin(y)+z \right\ra$. Compute the divergence and curl of $\B F$. Determine if the vector field is conservative.

\hfill This vector field \quad {\bf\large IS \  / \  IS NOT} \quad conservative.

\vfill

\noindent 
{\bf\large 3. (9 points)} Use a double Riemann sum to approximate $\displaystyle \iint\limits_{R} \cos(x+y^2)\,dA$ where $R = [-2,2] \times [0,6]$.\\ Use midpoint rule and a $2 \times 2$ grid of rectangles (2 across and 2 up) to partition $R$. \hfill (Don't worry about simplifying.)


\vspace{1.5in}

\newpage


\noindent {\bf\large 4. (10 points)} Let $R$ be the region in the first quadrant bounded outside $x^2+y^2=1$ and inside $x^2+y^2=4$. 

\force \hspace*{0.9in} [Warning: One of the integrals below will have to be split into 2 pieces.]

\vspace{-0.1in}

\begin{minipage}{5in}
\begin{enumerate}[(a)]
   \item Set up the integral $\iint_R 2\cos(x^2+y^2)\,dA$ using the order of integration ``$dy\,dx$''. 
%   \item Set up the integral $\iint_R 2\cos(x^2+y^2)\,dA$ using the order of integration ``$dx\,dy$''.
   \item Set up the integral $\iint_R 2\cos(x^2+y^2)\,dA$ using polar coordinates.
%   \item Evaluate the integral.
\end{enumerate}   

\underline{\bf Do not} evaluate this integral.
\end{minipage} \hfill
\begin{minipage}{1.5in}
% plot of wedge of circle as in Fall 2016's test #3 problem 3
%
%\begin{tikzpicture}
%\begin{axis}[
%  axis x line=middle, axis y line=middle,
%  width=5cm, height=2.5/3*5cm,     % size of the image = rigged to keep scaling=constrained
%  ymin=-0.5, ymax=2, ytick={0}, ylabel=$y$,
%  xmin=-0.5, xmax=2.5, xtick={0}, xlabel=$x$,
%]
%
%% fix glitchy fill 
%\addplot[name path=C,black!15, domain=0:1, smooth] ({2*x}, {0});
%\addplot[name path=D,black!15, domain=0:1, smooth] ({sqrt(2)*(1-x)}, {sqrt(2)*(1-x)});
%\addplot[black!15] fill between[of=C and D];
%\addplot[black, domain=0:1, smooth] ({2*x},{0});
%
%\addplot[name path=A,black, thick, domain=0:45, smooth] ({2*cos(x)}, {2*sin(x)});
%\addplot[name path=B,black, thick, domain=0:sqrt(2), smooth] ({x}, {x});
%
%\addplot[black!15] fill between[of=A and B];
%
%\node at (axis cs:1,0.4) {$R$};
%
%\end{axis}
%\end{tikzpicture}
%
\begin{tikzpicture}
\begin{axis}[
  axis x line=middle, axis y line=middle,
  width=5cm, height=4.9cm,     % size of the image = rigged to keep scaling=constrained
  ymin=-0.5, ymax=2.5, ytick={0}, ylabel=$y$,
  xmin=-0.5, xmax=2.5, xtick={0}, xlabel=$x$,
]

\addplot[name path=A,black, thick, domain=0:90, smooth] ({2*cos(x)}, {2*sin(x)});
\addplot[name path=B,black, thick, domain=0:90, smooth] ({cos(x)}, {sin(x)});

\addplot[yellow!50] fill between[of=A and B];

% redraw wiped out portion of axes
\addplot[black, domain=1:2, smooth] ({0}, {x});
\addplot[black, domain=1:2, smooth] ({x}, {0});

\node at (axis cs:1,1) {$R$};

\end{axis}
\end{tikzpicture}
\end{minipage}

\vspace{0.5in}

\vfill

\noindent {\bf\large 5. (12 points)} Evaluate $\displaystyle \int_0^6 \int_{y/2}^3 e^{x^2}\,dx\,dy$.  Include a sketch of the associated region of integration.

\vspace{0.05in}

{\it Note/Hint:} You cannot integrate $\int e^{x^2}\,dx$ in terms of elementary functions.

\vfill

\newpage

\noindent {\bf\large 6. (12 points)} Set up $\displaystyle \iint_R (x-y)^2e^{x-y}\,dA$ where $R$ is bounded by  $x=0$, $2x+y=1$, $x-y=0$, and $x-y=2$. 
Use the change of coordinates: $u=x-y$ and $v=2x+y$ \qquad  and\dots{}don't forget the Jacobian!

\vspace{0.1in}

\noindent
\underline{\bf Do not} evaluate this integral.

\vfill

\noindent {\bf\large 7. (12 points)} Consider the region $E$ above $z=2x^2+2y^2$ and below $z=3-x^2-y^2$. Compute the centroid of $E$.

\vspace{0.05in}

{\bf Note:} The volume of $E$ is $\dfrac{3}{2}\pi$. Also, you may use symmetry help cut down your work. 

\vspace{-0.1in}

$$ m = \iiint_E 1\,dV \qquad M_{yz} = \iiint_E x\,dV \qquad M_{xz} = \iiint_E y\,dV \qquad  M_{xy} = \iiint_E z\,dV \qquad (\bar{x},\bar{y},\bar{z}) = \left(\dfrac{M_{yz}}{m}, \dfrac{M_{xz}}{m},\dfrac{M_{xy}}{m} \right)$$

\vfill

\newpage

\noindent {\bf\large 8. (10 points)} Consider the integral: $\displaystyle I = \int_{-5}^0 \int_{-\sqrt{25-x^2}}^{\sqrt{25-x^2}} \int_0^{\sqrt{25-x^2-y^2}} \ \dfrac{y}{\sqrt{x^2+y^2+z^2}} \,dz\,dy\,dx$.   

\begin{enumerate}[(a)]
   \item Rewrite $I$ in the following order of integration: $\iiint \quad \,dy\,dx\,dz$.
   
   Do {\bf not} evaluate the integral.

\vspace{1in}
   
   \item Rewrite $I$ in terms of cylindrical coordinates.
   
   Do {\bf not} evaluate the integral.
   
\vspace{1in}

   \item Rewrite $I$ in terms of spherical coordinates.
   
   Do {\bf not} evaluate the integral.

\vspace{1in}

\end{enumerate}

\noindent {\bf\large 9. (14 points)} Let $E$ be the region inside $x^2+y^2+z^2=4$ and above $z=1$. Set up integrals which compute the volume of $E$ using the following orders of integration: \quad [Do {\bf not} evaluate these integrals.]

\vspace{-0.15in}

\begin{minipage}{4.5in}
\begin{enumerate}[(a)]
\item $\int_?^? \  \int_?^? \  \int_?^? \  ??? \,dz\,dy\,dx$
%\item $\int_?^? \  \int_?^? \  \int_?^? \  ??? \,dx\,dz\,dy$
\item Set up this integral in cylindrical coordinates.
\item Set up this integral in spherical coordinates.
\end{enumerate}
\vfill
\force
\end{minipage} \hfill
\begin{minipage}{2.75in}
%\iffalse %%%%%%%%%%%%%%%%%%%%%%%% block comment %%%%%%%%%%%%%%%%%%%%%%%%%%
\pgfplotsset{
  /pgfplots/colormap={mypink}{%
    color(0cm) = (purple);
    color(1cm) = (pink!80!purple);
    color(2cm) = (pink!90);
    color(3cm) = (pink) }
}
\pgfplotsset{
  /pgfplots/colormap={myblue}{%
    color(0cm) = (blue!55);
    color(1cm) = (blue!60);
    color(2cm) = (blue!65);
    color(3cm) = (blue!70) }
}
\pgfplotsset{
  /pgfplots/colormap={mygreen}{%
    color(0cm) = (green!40);
    color(1cm) = (green!60);
    color(2cm) = (green!80);
    color(3cm) = (green) }
}
\begin{tikzpicture}
    \begin{axis}[%
        axis equal,
        width=7cm,
        height=7cm,
        axis lines = none,  % vs. center
%        xlabel = {$x$},
%        ylabel = {$y$},
%        zlabel = {$z$},
        ticks=none,
%        enlargelimits=0.3,
%        view/h=15,
         view={35}{15},
%        colormap = {whiteblack}{color(0cm)  = (white);color(1cm) = (black)},
        scale uniformly strategy=units only,
    ]
    \addplot3[%
        opacity = 0.25,
        surf,
        z buffer = sort,
        samples = 20,
        colormap name=myblue,
        variable = \u,
        variable y = \v,
        domain = 0:360,
        y domain = 0:180,
    ]
    ({2*cos(u)*sin(v)}, {2*sin(u)*sin(v)}, {2*cos(v)});

    \addplot3[%
        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 10,
        colormap name=mygreen,
        variable = \u,
        variable y = \v,
        domain = -2.75:2.75,
        y domain = -2.75:2.75,
    ]
    ({u}, {v}, {1});


    \addplot3[%
%        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 20,  % 20 for nicer look
        colormap name=myblue,
        variable = \u,
        variable y = \v,
        domain = 0:360,
        y domain = 0:60,
    ]
    ({2*cos(u)*sin(v)}, {2*sin(u)*sin(v)}, {2*cos(v)});
    \end{axis}
\end{tikzpicture}
%\fi %%%%%%%%%%%%%%%%%%%%%%%% end block comment %%%%%%%%%%%%%%%%%%%%%%%%%%
\end{minipage}

\vfill

\vfill


\end{document}

