2.05 2D Integrals and the Gauss-Green Formula
GIVE IT A TRY!

Off[General::spell]; Off[General::spell1]; Off[Plot::plnr]; Off[ParametricPlot3D::ppcom]; SetOptions[Limit, Analytic -> True]; \(Needs["Graphics`FilledPlot`"]; 


    If[MemberQ[{"Global`", \ "Miscellaneous`SIUnits`", \ 
          "Graphics`Colors`"}, 
\ \ \ \ Context[Gray]], \ 
      Remove["*`Gray"]]; 
<< "Miscellaneous`Units`"; 

    Remove["*`Gray"]; 
<< "Graphics`Colors`"; 

    Graphics`Colors`GosiaGreen = RGBColor[0, \ 0.392187, \ 0]; 

    
$Pre\  = \ Chop; 
CMView\  = \ {2.7, \ 1.6, \ 1.2}; \)

G.1) Volume measurements*

G.1.a)

Here is the surface
        z = f[x, y] = 2  Sin[x + y] + 2.5
plotted over the rectangle R in the xy-plane consisting of the points
       {x, y, 0} with -2 ≤ x ≤ 2 and -3 ≤ y ≤ 3:

\(\(Clear[x, y, z, r, t, f]; 

    f[x_, y_]\  = \ 2\ Sin[x\  + \ y]\  + \ 2.5; 


    surfaceplot\  = \ 
      Plot3D[f[x, y], {x, \(-2\), 2}, {y, \(-3\), 3}, 
\ \ \ \ \ \ \ 
        DisplayFunction -> Identity]; 
\ \ \ \ \ \ \ 

    Rplot\  = \ 
      Graphics3D[
\ \ \ \ 
        Polygon[{{\(-2\), \(-3\), 0}, {2, \(-3\), 0}, {2, 3, 0}, {\(-2\), 3, 
              0}}]]; 
\ \ \ \ 
spacer\  = \ 0.2; 
\ \ \ \ 

    threedims\  = \ 
\ \ \ \ \ \ 
      Graphics3D[{

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, 
            Line[{{\(-2.2\), 0, 0}, {2.2, 0, 0}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["x", {2.2\  + \ spacer, 0, 0}], 

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, 
            Line[{{0, \(-3.2\), 0}, {0, 3.2, 0}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["y", {0, \ 3.2\  + \ spacer, 0}], 

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, Line[{{0, 0, 0}, {0, 0, 4.5}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["z", {0, 0, 4.5\  + \ spacer\  + \ 0.1}]}]; \ 

    \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 

    CMView\  = \ {2.7, \ 1.6, \ 1.2}; 


    Show[threedims, Rplot, surfaceplot, PlotRange -> All, 
\ \ \ \ 
      ViewPoint -> CMView, Boxed -> False, 
\ \ \ \ 
      DisplayFunction -> $DisplayFunction]; \ \ \ \ \ \ \ \ 
\ \ \ \)\)

Use a double integral to measure the volume of the solid consisting of everything between the surface and the rectangle.

G.1.b)

Here is the surface 
         z = f[x, y] = x y + 3
plotted above the region R inside the ellipse 
       ((((x/2)))^2)+((((y/3)))^2)=1 
in the xy-plane.

\(Clear[x, y, z, r, t, f]; 
f[x_, y_]\  = \ x\ y\  + \ 3; 


    surfaceplot\  = \ 
      ParametricPlot3D[

        \ \ \ \ \ \ {2\ r\ Cos[t], 3\ r\ Sin[t], 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ f[2\ r\ Cos[t], 3\ r\ Sin[t]]}, 

        \ \ \ \ \ \ {r, 0, 1}, {t, 0, \ 2\ Pi}, 
\ \ \ \ \ \ \ 
        DisplayFunction -> Identity]; 

    Rplot\  = \ 
      ParametricPlot3D[
\ \ \ \ \ \ {2\ r\ Cos[t], 3\ r\ Sin[t], 0}, 

        \ \ \ \ \ \ {r, 0, 1}, {t, 0, \ 2\ Pi}, 
\ \ \ \ \ \ \ 
        PlotPoints -> {2, Automatic}, 
\ \ \ \ \ \ \ 
        DisplayFunction -> Identity]; 


    threedims\  = \ 
\ \ \ \ \ \ 
      Graphics3D[{

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, 
            Line[{{\(-2.2\), 0, 0}, {2.2, 0, 0}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["x", {2.2\  + \ spacer, 0, 0}], 

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, 
            Line[{{0, \(-3.2\), 0}, {0, 3.2, 0}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["y", {0, \ 3.2\  + \ spacer, 0}], 

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, Line[{{0, 0, 0}, {0, 0, 6.2}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["z", {0, 0, 6.2\  + \ spacer\  + \ 0.2}]}]; \ 

    \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 

    CMView\  = \ {2.7, \ 1.6, \ 1.2}; 


    Show[threedims, surfaceplot, Rplot, PlotRange -> All, 
\ \ \ \ 
      ViewPoint -> CMView, Boxed -> False, 
\ \ \ \ 
      DisplayFunction -> $DisplayFunction]; \)

Think of the solid that consists of everything below the surface and above the ellipse R, and use the Gauss-Green formula to help you measure the volume of this solid.

G.1.c.i)

Use the idea of volume calculation to explain the statement:
If a function f[x, y] takes only positive values on a region R in the xy-plane, then
       ∫(∫_R) f[x, y] dx 
              dy > 0.

G.1.c.ii)

Explain the statement:
If for a given function f[x, y] and a given region R in the xy-plane, it turns out that ∫(∫_R) f[x, y] dx 
              dy < 0, then you are guaranteed that there are some points {x, y} in R with f[x, y] < 0.

G.2) Calculating double integrals*

G.2.a)

Here's a region R plotted in the xy-plane.

\(Clear[y]; 

    Rplot = ParametricPlot[{{y\ \((y - 6)\) + 1, y}, {
            Cos[\(π\ y\)\/6]\^2, y}}, {y, 0, 6}, 
		
        PlotStyle -> {{Red, Thickness[0.01]}}, 
        AxesLabel -> {"x", "y"}, 
        Epilog -> Text["R", {\(-4\), 3}]]; \)

Go with 
       f[x, y] = y - x + 3 
and calculate
       ∫(∫_R) f[x, y] dx 
            dy
by the method of least labor on your part.

G.2.b)

Here's another region R plotted in the xy-plane.

\(Clear[x, y, t]; 
x[t_] = Cos[t]\ \((1 - Cos[t])\); 

    y[t_] = Sin[t]\ \((1 - Cos[t])\); 


    Rplot = ParametricPlot[{x[t], y[t]}, {t, 0, 2\ π}, 
		
        PlotRange -> All, PlotStyle -> {{Red, Thickness[0.01]}}, 
        AxesLabel -> {"x", "y"}, 
        Epilog -> Text["R", {\(-1\), 0.5}]]; \)

Go with 
       f[x, y] = 3 + y - x
and calculate
       ∫(∫_R) f[x, y] dx 
            dy
by the method of least labor on your part.

Next, go with
       g[x, y] = 3 - x 
and calculate
       ∫(∫_R) g[x, y] dx 
            dy
by the method of least labor on your part.

Compare the values of
       ∫(∫_R) f[x, y] dx 
            dy and ∫(∫_R) g[x, y] dx 
            dy.
Discuss how you think that the shape and position of R account for the relationship between these two numbers.

G.2.c)

Here is another region R plotted in the xy-plane.

\(Clear[high, low, y]; 
xhigh[y_] = E\^\(-y\^2\); 
xlow[y_] = 1 - y\^2; 
    

Rplot = 
      ParametricPlot[{{xhigh[y], y}, {xlow[y], y}}, {y, \(-2\), 2}, 
		
        PlotStyle -> Red, \ AxesLabel -> {"x", "y"}, 
        PlotRange -> All, AspectRatio -> Automatic, 
        Epilog -> {{Red, 
              Line[{{xlow[\(-2\)], \(-2\)}, {xhigh[\(-2\)], \(-2\)}}]}, {Red, 
              Line[{{xlow[2], 2}, {xhigh[2], 2}}]}, 
            Text["Top half of R", {\(-1\), 1.7}], 
            Text["Bottom half of R", {\(-1\), \(-1.7\)}]}]; \)

Go with 
       f[x, y] = y (E^(-x))
       g[x, y] = (y^2) (E^(-x)) and
       h[x, y] = (y^3) (E^(-x)) 
and calculate
       ∫(∫_R) f[x, y] dx 
            dy,
       ∫(∫_R) g[x, y] dx 
            dy, and 
       ∫(∫_R) h[x, y] dx 
            dy
by the method of least labor on your part.
Look at the formulas for f[x, y] and g[x, y] and then look at the shape and position of R and explain why it was no surprise that
       ∫(∫_R) f[x, y] dx 
            dy and ∫(∫_R) h[x, y] dx 
            dy 
came out the way they did.

G.2.d)

Here is another region R plotted in the xy-plane.

\(Clear[x, y, Rplot]; 

    Rplot = Plot[{3\ Sin[\(π\ x\)\/4]\^2, x\ \((4 - x)\)}, {x, 0, 4}, 

        		PlotStyle -> {{Red, Thickness[0.01]}}, 
        AxesLabel -> {"x", "y"}, 
        Epilog -> Text["R", {2, 3.5}]]; \)

Go with 
       f[x, y] = 4  x - y 
and calculate
       ∫(∫_R) f[x, y] dx 
            dy
by the method of least labor on your part.

G.2.e)

Given that the region R consists of everything inside the ellipse
       (((((x + 3)/7)))^2)+(((((y - 1)/2)))^2)=1,
go with
       f[x, y] = (x^2) - 3  (y^2) 
and calculate
       ∫(∫_R) f[x, y] dx 
            dy
by the method of least labor on your part.

G.3) Area and volume measurements via the Gauss-Green formula*

The Gauss-Green formula says
       ∫(∫_R)(∂_x) n[x, y] - 
        (∂_y) m[x, y] dx dy
        = 
        (∫_a^b) m[x[t], y[t]] x'[t] + 
          n[x[t], y[t]] y'[t] dt
provided that {x[t], y[t]} sweeps out the boundary of the region R exactly one time in the counterclockwise fashion as t advances from a to b.
If you take m[x, y] = y and n[x, y] = 0 and plug into the Gauss-Green formula, then you get
       -
        ∫(∫_R) 1 dx 
              dy
        = 
        ∫(∫_R)(0 - 1) dx 
              dy
        = 
        (∫_a^b)(y[t] x'[t] + 0  y'[t]) 
            dt
        = (∫_a^b) y[t] x'[t] dt.
Consequently,
       -(∫_a^b) y[t] x'[t] dt 
measures the area of R provided that {x[t], y[t]} sweeps out the boundary of R exactly one time in the counterclockwise fashion as t advances from a to b.

G.3.a.i)

Adapt the discussion above to explain why
       (∫_a^b) x[t] y'[t] dt 
also measures the area of R provided that {x[t], y[t]} sweeps out the boundary of R exactly one time in the counterclockwise fashion as t advances from a to b.

G.3.a.ii)

Explain why
       ((1/2))(∫_a^b)(x[t] y'[t] - y[t] x'[t]) 
            dt 
measures the area of R provided that {x[t], y[t]} sweeps out the boundary of R exactly one time in the counterclockwise fashion as t advances from a to b.

What happens when you average two correct measurements?

G.3.a.iii)

Here's the plot of a whimsical region R in the xy-plane.

\(Clear[x, y, t]; 
x[t_] = Cos[t]\ \((1 - Sin[t] - Cos[t])\); 


    y[t_] = Sin[t]\ \((3 - Cos[t] - Sin[t])\); 


    Rplot = ParametricPlot[{x[t], y[t]}, {t, 0, 2\ π}, 
		
        PlotRange -> All, PlotStyle -> {{Red, Thickness[0.01]}}, 
        AxesLabel -> {"x", "y"}, 
        Epilog -> Text["R", {\(-1\), 1\/2}]]; \)

Choose any of the three formulas explained above to measure the area of this region.

G.3.a.iv)

Here's the plot of another region R in the xy-plane.

\(Clear[x, y, t]; 

    x[t_] = Cos[2\ t]\ \((3\/2 - 1\/3\ Sin[4\ t] - Cos[8\ t])\); 


    y[t_] = Sin[2\ t]\ \((4 - 1\/3\ Cos[4\ t] - 1\/5\ Sin[8\ t])\); 


    Rplot = ParametricPlot[{x[t], y[t]}, {t, 0, 2\ π}, 
		
        PlotRange -> All, PlotStyle -> {{Red, Thickness[0.01]}}, 
        AxesLabel -> {"x", "y"}, 
        Epilog -> Text["R", {1\/2, 2}]]; \)

Using the formula (∫_a^b) x[t] y'[t] dt with a = 0 and b = 2  π to measure the area inside this region, you get the area measurement:

NIntegrate[x[t] y'[t], {t, 0, 2 π}, AccuracyGoal -> 2]

Unfortunately, this measurement is way off. 
Find the error and come up with the correct measurement.

G.3.b) Using m[x, y] instead of n[x, y] in Gauss-Green calculations

Here's a plot of the surface 
         z = f[x, y] = 5 - 0.2 ((x^2) + (y^2))
above the region R in the xy-plane consisting of all points {x, y, 0} with {x, y} inside the ellipse
       (((((x + 1)/2)))^2)+(((((y + 1)/3)))^2)=1:

\(\(Clear[f, x, y, r, t]; 
    
{x[r_, t_], y[r_, t_]}\  = 
      \ {\(-1\), \(-1\)}\  + \ r\ {2\ Cos[t], 3\ Sin[t]}; 

    f[x_, y_]\  = \ 5\  - \ 0.2 \((x\^2 + y\^2)\); 
\ 

    surfaceplot\  = \ 
      ParametricPlot3D[
\ \ \ 
        Evaluate[{x[r, t], y[r, t], f[x[r, t], y[r, t]]}], 

        \ \ \ \ \ \ {t, 0, 2\ Pi}, {r, 0, 1}, 
\ \ \ \ \ \ 
        DisplayFunction -> Identity]; 
\ \ \ \ \ \ 

    Rplot\  = \ 
      ParametricPlot3D[Evaluate[{x[r, t], y[r, t], 0}], 

        \ \ \ \ \ \ {t, 0, 2\ Pi}, {r, 0, 1}, PlotPoints -> {Automatic, 2}, 

        \ \ \ \ \ \ DisplayFunction -> Identity]; 
\ \ \ \ \ \ 

    label\  = \ Graphics3D[Text["R", {\(-1\), 1, 0}]]; 


    spacer\  = \ 0.2; 

    threedims\  = \ 
\ \ \ \ \ \ 
      Graphics3D[{

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, 
            Line[{{\(-3\), 0, 0}, {1.5, 0, 0}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["x", {1.5\  + \ spacer, 0, 0}], 

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, 
            Line[{{0, \(-4\), 0}, {0, 2.5, 0}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["y", {0, \ 2.5\  + \ spacer, 0}], 

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, Line[{{0, 0, 0}, {0, 0, 5.5}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["z", {0, 0, 5.5\  + \ spacer}]}]; 

    CMView\  = \ {2.7, 1.6, 1.2}; 


    Show[surfaceplot, Rplot, label, threedims, 
\ \ \ \ \ \ \ \ 
      ViewPoint -> CMView, PlotRange -> All, 
\ \ \ \ \ \ \ \ 
      DisplayFunction -> $DisplayFunction]; \ \)\)

One way of measuring the volume of the solid consisting of all points between or on the ellipse and the surface plotted above is to realize that the top surface is just a plot of f[x, y] for points {x, y, 0} inside the ellipse R in the xy-plane.  The volume measurement is just
        ∫(∫_R) f[x, y] dx 
            dy,
which you can easily calculate with the Gauss-Green formula once you remember the ellipse
       (((((x + 1)/2)))^2)+(((((y + 1)/3)))^2)=1
(which is the boundary of R) is parameterized in the counterclockwise way by
       {x[t], y[t]} = {-1, -1} + {2  Cos[t], 3  Sin[t]}
with 0 ≤ t ≤ 2  π.
Now you can turn the winning team of Mathematica and the Gauss-Green formula loose:

\(Clear[n, m, x, y, s, t]; 
m[x_, y_] = 0; 

    n[x_, y_] = ∫\_0\%x f[s, y] \[DifferentialD]s; 

a = 0; 

    b = 2\ π; 

    
{x[t_], y[t_]} = {\(-1\), \(-1\)} + {2\ Cos[t], 3\ Sin[t]}; 


    volume = NIntegrate[
        m[x[t], y[t]]\ \(x'\)[t] + n[x[t], y[t]]\ \(y'\)[t], {t, a, b}]\)

Now look at this alternate calculation:

\(Clear[n, m, x, y, s, t]; 

    m[x_, y_] = ∫\_0\%y\(-f[x, s]\) \[DifferentialD]s; 

    n[x_, y_] = 0; 

a = 0; 
b = 2\ π; 

    
{x[t_], y[t_]} = {\(-1\), \(-1\)} + {2\ Cos[t], 3\ Sin[t]}; 


    volume = NIntegrate[
        m[x[t], y[t]]\ \(x'\)[t] + n[x[t], y[t]]\ \(y'\)[t], {t, a, b}]\)

Use the Gauss-Green formula
       ∫(∫_R) D[n[x, y], x] - 
        D[m[x, y], y] dx dy
        = 
        (∫_a^b) m[x[t], y[t]] x'[t] + 
          n[x[t], y[t]] y'[t] dt
and the fundamental formula of calculus to explain why the alternate calculation was guaranteed to work.

G.4) Plot3D versus ParametricPlot3D*

G.4.a.i)

Go with f[x] = x (E^(-x)) and explain with words and pictures what you think that this plot represents:

\(Clear[f, x]; 
{a, b} = {\(-0.6\), 8}; 
f[x_] = x\^2\ E\^\(-x\); 


    raw = Plot[f[x], {x, a, b}, PlotRange -> All]; \)

G.4.a.ii)

Stay with the same function f[x] and the same values for a and b and look at:

parametric = 
      ParametricPlot[{x, f[x]}, {x, a, b}, PlotRange -> All];

See the two plots side-by-side:

Show[GraphicsArray[{raw, parametric}]];

Say what happened, and try to explain why it will happen no matter what function f[x] you go with.

G.4.b)

Go with f[x, y] = 2 + Sin[y] - x and explain with words and pictures what you think this plot represents:

\(Clear[f, x, y]; 
    
{{a, b}, {c, d}} = {{\(-2\), 2}, {\(-\(π\/3\)\), π\/2}}; 

    \(f[x_, y_] = 2 + Sin[2\ y] + x\/2; \)\)\(CMView = {2.7, 1.6, 1.2}; 


    raw = Plot3D[f[x, y], {x, a, b}, {y, c, d}, ViewPoint -> CMView, 
        BoxRatios -> Automatic]; \)

G.4.c)

Look at this plot:

\(Clear[f, x, y]; 
{a, b} = {3, 2}; 
\(f[x_, y_] = Sin[x - y]; \)\)\(CMView = {2.7, 1.6, 1.2}; 


    regular = 
      Plot3D[f[x, y], {x, \(-a\), a}, {y, \(-b\), b}, 
        ViewPoint -> CMView, BoxRatios -> Automatic]; \)

Stay with the same function f[x, y] and the same a and b, and look at this parametric plot:

\(\(parametric = 
      ParametricPlot3D[{x, y, f[x, y]}, {x, \(-a\), a}, 
		{y, \(-b\), b}, 
        ViewPoint -> CMView, BoxRatios -> Automatic]; \)\)

See them side-by-side:

Show[GraphicsArray[{regular, parametric}]];

Say what happened, and try to explain why it will happen no matter what function f[x, y] you go with.

G.5) Big league plotting and measuring

G.5.a.i)

When you want to plot the ellipse
       (((((x - 2)/5)))^2)+(((((y - 1)/3)))^2)=1 
in two dimensions in true scale with a counterclockwise parameterization, you can go with:

\(Clear[x2D, y2D, t]; 
    
{x2D[t_], y2D[t_]} = {2, 1} + {5\ Cos[t], 3\ Sin[t]}; 


    ParametricPlot[{x2D[t], y2D[t]}, {t, 0, 2\ π}, 
	
      PlotStyle -> Thickness[0.01], AspectRatio -> Automatic, 
      AxesLabel -> {"x", "y"}]; \)

When you want to plot the same ellipse
       (((((x - 2)/5)))^2)+(((((y - 1)/3)))^2)=1
and everything inside it on the xy-plane in three dimensions with a counterclockwise parameterization, you can go with:

\(\(Clear[x, y, z, t]; 
    
{x[r_, t_], y[r_, t_], z[r_, t_]}\  = \ 

      \ \ \ \ \ \ \ \ {2, 1, 0}\  + \ r\ {5\ Cos[t], 3\ Sin[t], 0}; 

    \ \ \ \ \ \ \ \ 

    Rplot\  = \ 
      ParametricPlot3D[{x[r, t], y[r, t], z[r, t]}, 
        
{r, 0, 1}, {t, 0, 2\ Pi}, 
PlotPoints -> {2, Automatic}, 
        DisplayFunction -> Identity]; 
\ \ 
spacer\  = \ 0.2; 

    threedims\  = \ 
\ \ \ \ \ \ 
      Graphics3D[{

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, 
            Line[{{\(-3\), 0, 0}, {7.5, 0, 0}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["x", {7.5\  + \ spacer, 0, 0}], 

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, 
            Line[{{0, \(-2\), 0}, {0, 4.5, 0}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["y", {0, \ 4.5\  + \ spacer, 0}], 

          \ \ \ \ \ \ \ \ \ \ \ \ {Blue, Line[{{0, 0, 0}, {0, 0, 2}}]}, 

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
          Text["z", {0, 0, 2\  + \ spacer}]}]; 

    CMView\  = \ {2.7, 1.6, 1.2}; 


    threeDplot\  = \ 
      Show[Rplot, threedims, BoxRatios -> Automatic, 
\ \ \ \ \ \ \ \ 
        ViewPoint -> CMView, PlotRange -> All, 
\ \ \ \ \ \ \ \ 
        DisplayFunction -> $DisplayFunction]; \ 
\)\)

Now look at this:

{{x2D[t], y2D[t]}, {x[r, t], y[r, t], z[r, t]}}

Where do the points
       {x[r, t], y[r, t], z[r, t]} 
land when you go with r = 0?
Where do the points
       {x[r, t], y[r, t], z[r, t]}
land when you go with 0 < r < 1?
Where do the points
       {x[r, t], y[r, t], z[r, t]} 
land when you go with r = 1?

G.5.a.ii)

Give a plot of the part of the surface         
       z = f[x, y] = 1 + (E^(((3 - x + y)/5)))
consisting of the points {x, y, z} such that {x, y, 0} is in the elliptical region in the xy-plane plotted above. Show the surface plot together with the plot of the elliptical region in the xy-plane.
Measure the volume of the solid whose top skin is the part of the surface you plotted and whose bottom skin is the elliptical region in the xy-plane plotted above.

When you are plotting the surface, don't use the plotting option PlotPoints->{2,Automatic}.
When you make the volume measurement, use the Gauss-Green formula and NIntegrate.

G.5.b.i)

Here's a plot of a corny curve in two dimensions:

\(Clear[x2D, y2D, t]; 
    
{x2D[t_], y2D[t_]} = {2\ Cos[t] - 1\/3\ Cos[3\ t], 
        Sin[t] - 1\/6\ Sin[2\ t]}; 


    corn = ParametricPlot[{x2D[t], y2D[t]}, {t, 0, 2\ π}, 
        PlotStyle -> {{Thickness[0.01], DarkGoldenrod}}, 
        AspectRatio -> Automatic, AxesLabel -> {"x", "y"}]; 
    \)

Plot the same curve and everything inside it on the xy-plane in three dimensions with a counterclockwise parameterization.

G.5.b.ii)

Give a plot of the part of the surface         
       z = f[x, y] = 1 + 0.2  (x^2) - 0.2  (y^2)
consisting of the points {x, y, z} such that {x, y, 0} is in the region in the xy-plane that you plotted above. Show the surface plot together with the plot of the region in the xy-plane.  Measure the volume of the solid whose top skin is the part of the surface you plotted and whose bottom skin is the region in the xy-plane you plotted in part i).

When you are plotting the surface, don't use the plotting option
PlotPoints->{2,Automatic}.

G.6) Average value and centroids

Most math folks say that the average value of a function f[x] on an interval [a, b] is the number A satisfying
       (∫_a^b) f[x] dx = 
        A (b - a) = A (∫_a^b)dx.
Going with this formula, you see that the average value of Cos[x] on [1, 3] is given by:

A = NIntegrate[Cos[x], {x, 1, 3}]/(3 - 1)

The following routine calculates Cos[x] for 50 random points x chosen out of [1, 3] by Mathematica:

\(Clear[k]; 

    randoms = Table[N[Cos[Random[Real, {1, 3}]]], {k, 1, 50}]\)

Average these values:

\(average\  = 

      Sum[randoms[\([k]\)], 
\ \ \ \ \ \ {k, 1, Length[randoms]}]/
        Length[randoms]\)

Do it again for 100 randomly chosen points from [1, 3]:

\(Clear[k]; 

    randoms\  = \ Table[N[Cos[Random[Real, {1, 3}]]], {k, 1, 100}]; 


    average\  = 

      Sum[randoms[\([k]\)], 
\ \ \ \ \ \ {k, 1, Length[randoms]}]/
        Length[randoms]\)

Do it again for 300 randomly chosen points from [1, 3]:

\(randoms\  = \ Table[N[Cos[Random[Real, {1, 3}]]], {k, 1, 300}]; 


    average\  = 

      Sum[randoms[\([k]\)], 
\ \ \ \ \ \ {k, 1, Length[randoms]}]/
        Length[randoms]\)

G.6.a)

In your opinion, how is the average value of Cos[x] on [1, 3] calculated through the formula
       (((∫_1^3) Cos[x] dx)/(3 - 1)),
as above, related to the outcomes of the numerical experiments?

G.6.b.i)

Calculate the average value of Sin[x] on [0, π] in decimals.

G.6.b.ii)

Look at:

\(randoms\  = \ Table[N[Sin[Random[Real, {0, N[Pi]}]]], {k, 1, 300}]; 


    average\  = 

      Sum[randoms[\([k]\)], 
\ \ \ \ \ \ {k, 1, Length[randoms]}]/
        Length[randoms]\)

\(randoms\  = \ Table[N[Sin[Random[Real, {0, N[Pi]}]]], {k, 1, 300}]; 


    average\  = 

      Sum[randoms[\([k]\)], 
\ \ \ \ \ \ {k, 1, Length[randoms]}]/
        Length[randoms]\)

\(randoms\  = \ Table[N[Sin[Random[Real, {0, N[Pi]}]]], {k, 1, 300}]; 


    average\  = 

      Sum[randoms[\([k]\)], 
\ \ \ \ \ \ {k, 1, Length[randoms]}]/
        Length[randoms]\)

\(randoms\  = \ Table[N[Sin[Random[Real, {0, N[Pi]}]]], {k, 1, 300}]; 


    average\  = 

      Sum[randoms[\([k]\)], 
\ \ \ \ \ \ {k, 1, Length[randoms]}]/
        Length[randoms]\)

Discuss the results.

G.6.c) Average value of f[x, y] on a region R

Above, you saw that the average value of a function f[x] on an interval [a, b] on the x-axis is the number A satisfying
       (∫_a^b) f[x] dx = 
        A (b - a) = A (∫_a^b)dx.
Math folks have a similar notion for functions of two variables; they say:
The average value of a function f[x, y] on a region R in the xy-plane is the number A satisfying
       ∫(∫_R) f[x, y] dx 
              dy = 
        A ∫(∫_R)dx 
                dy.
Calculate the average value of f[x, y] = (x^2) + (y^2) on the rectangle R consisting of the the points with -3 ≤ x ≤ 3 and -2 ≤ y ≤ 2.

G.6.d.i) Centroid of a region

The centroid of a region R in the xy-plane is the point \({\(x\^*\), \(y\^*\)}\) where
       \(\(x\^*\)\) is the average value of f[x, y] = x on R and
       \(\(y\^*\)\) is the average value of g[x, y] = y on R.
Calculate the centroid of the rectangle R consisting of the the points with -3 ≤ x ≤ 3 and -2 ≤ y ≤ 2.
Are you surprised by the result?

G.6.d.ii)

Here's region R plotted in the xy-plane:

\(Clear[x, y, t]; 
x[t_] = Cos[t]\ \((1 - Cos[t])\); 


    y[t_] = Sin[t]\ \((1 - Cos[t])\); 


    Rplot = ParametricPlot[{x[t], y[t]}, {t, 0, 2\ π}, 
		
        PlotRange -> All, PlotStyle -> {{Red, Thickness[0.01]}}, 
        AxesLabel -> {"x", "y"}, 
        Epilog -> Text["R", {\(-0.8\), 0.5}]]; \)

Use the Gauss-Green formula to help you to calculate the centroid of this region.

G.6.d.iii)

Here's another region R plotted in the xy-plane:

\(Clear[x, Rplot]; 

    Rplot = Plot[{3\ Sin[\(π\ x\)\/4]\^2, x\ \((4 - x)\)}, {x, 0, 4}, 

        		PlotStyle -> {{Red, Thickness[0.01]}}, 
        AxesLabel -> {"x", "y"}, 
        Epilog -> Text["R", {2, 3.5}]]; \)

Calculate the centroid of this region.
Is the centroid inside or outside the region?

G.6.d.iv)

Sometimes you can look at a plot of a region R and know before you do any calculation that the centroid of R will calculate out to be inside R.
What is it about the bulges and hollows of the plot of the boundary of R that helps you to do this?

G.7) Bombing runs

G.7.a.i)

You've got a target sitting at {0, 0} and you want to knock it out with an iron bomb. If you set the Northrup bomb sight to hit the target at {0, 0} and examine the point {x, y} at which an individual bomb lands, you will find that the resulting coordinates x and y
→   have no influence on each other;
→   are both normally distributed;  and 
→   both average out to {0, 0}.
You will also find that the standard deviation of the x measurement is not the same as the standard deviation of the y measurement.
For a specific bomb and airplane, it turns out that
       xdev = 50 feet and ydev = 100 feet. 
And to destroy the target, this type of bomb must hit within 100 feet of the target. 
Estimate the fraction of the bombs of this type, aimed at this target, that actually destroy the target.

G.7.a.ii)

In part i) above, what are your chances of destroying the target if you bomb it twice?
How many times do you have to bomb the target to get 95  % confidence of destroying it?

G.7.b.i)

This time your target is a long, thin radar installation 100 feet long centered on {0, 0} and visualized as the line segment running from {-50, 0} to {50, 0}:

radarstation = 
      Show[Graphics[{Blue, Thickness[0.02], Line[{{-50, 0}, {50, 0}}]}], 
        Graphics[Text["Radar Station", {0, 5}]], 
        PlotRange -> {{-80, 80}, {-30, 30}}, Axes -> True, 
        AxesLabel -> {"x", "y"}];

The Air Force bomb damage assessment analysts have determined that to knock out this radar station, you must place your iron bomb within the ellipse
       ((((x/60)))^2)+((((y/100)))^2)=1:

\(Clear[x, y, t]; 
x[t_] = 60\ Cos[t]; 
y[t_] = 100\ Sin[t]; 


    ellipse = 
      ParametricPlot[{x[t], y[t]}, {t, 0, 2\ π}, 
        PlotStyle -> {{Thickness[0.01], Red}}, 
        DisplayFunction -> Identity]; 


    Show[ellipse, radarstation, 
	AspectRatio -> Automatic, 
      PlotRange -> All, DisplayFunction -> $DisplayFunction]; \)

Here are two reasons for the shape of the ellipse:
→   The long, flat nature of the radar station makes it very vulnerable to bombs that land to its front or rear.
→   The same long, flat nature of the radar station makes it almost invulnerable to bombs that land to its left or right.
The bombs you are going to use have
       xdev = 40 feet and ydev = 80 feet.
Estimate the fraction of the bombs aimed at {0, 0} that actually destroy the radar station.

G.7.b.ii)

In part i) above, what are your chances of destroying the radar station if you bomb it twice aiming the bombs at {0, 0}?
How many times do you have to bomb the radar station, aiming the bombs at {0, 0}, to get 95  % confidence of destroying the radar station?