VC.07 Transforming 2D Integrals
 LITERACY

\(Off[General::spell]; 
Off[General::spell1]; 

    \(Off[ParametricPlot3D::ppcom]; \)\)Off[ParametricPlot::ppcom]; Off[Plot::plnr]; \(SetOptions[Limit, Analytic -> True]; 
$Pre\  = \ Chop; \)

CMView = {2.7, 1.6, 1.2};

Vector Drawer

BeginPackage["Vector3D`", "Graphics`Colors`"];

\(Axes3D::"usage" = 
      "Axes3D[a, b] creates a Graphics3D object of cartesian axes with x, y, and z running from -a/3 to a, and with axes labels b units beyond the tips of the axes.  Axes3D[a] is Axes3D[a, a/8]."; 

    \(Perpend::"usage" = 
      "Perpend[a] returns a unit vector which is perpendicular to the vector a."; \)\)Arrow::"usage" = 
      "Arrow[a] produces a 2 or 3 dimensional vector from the origin to a. \
Arrow[a, Tail -> tail] gives a vector from tail to a."; Vector::"usage" = 
      "Vector[a, b] gives a 2D or 3D vector from a to b."; ArrowHead::"usage" = 
      "ArrowHead[a, vec] produces an arrowhead with its tip placed at the \
point a, pointing in the direction of the vector vec."; Tail::"usage" = 
      "Tail -> point puts the tail of the vector at point."; Norm::"usage" = 
      "Norm[vec] returns the Euclidean length of vec."; Normalize::"usage" = 
      "Normalize[vec] returns a unit vector in the direction of vec, \
provided vec is nonzero."; Aperture::"usage" = 
      "Aperture is the ratio of the radius of the base to the length of the \
head of a vector."; TipSize::"usage" = 
      "TipSize specifies an absolute size for the inner tip length of the \
head of a vector."; TipRatio::"usage" = 
      "TipRatio is the ratio of the inner length of the arrowhead to the \
length of the shaft of a vector."; HeadRatio::"usage" = 
      "HeadRatio is the ratio of the outer length of the arrowhead to the \
length of the shaft of a vector."; HeadSize::"usage" = 
      "HeadSize specifies an absolute size for the head of a vector."; 
    ScaleFactor::"usage" = 
      "ScaleFactor specifies the amount to scale a vector in length and may \
be either a number or a pure function."; ZeroVectorPointSize::"usage" = 
      "ZeroVectorPointSize is the size of the point used to represent a \
zero vector."; Options[Vector] = 
      Options[Arrow] = 
        Options[ArrowHead] = {HeadRatio -> 0.18, 
            TipRatio -> 0.14, Aperture -> 0.3, 
            ScaleFactor -> 1, HeadType -> Polygon, 
            ShaftQ -> True, EdgesQ -> True, 
            VectorColor -> RGBColor[0, 0, 1], ShaftWidth -> 0.005, 
            ZeroVectorPointSize -> 0.01}; Begin["`Private`"]; SetOptions[ParametricPlot, AspectRatio -> Automatic]; SetOptions[Plot, AspectRatio -> Automatic]; SetOptions[Graphics, AspectRatio -> Automatic]; Axes3D[u_, v_] := 
      Graphics3D[{{Blue, Line[{{-(u/3), 0, 0}, {u, 0, 0}}]}, 
          Text["x", {u + v, 0, 0}], {Blue, 
            Line[{{0, -(u/3), 0}, {0, u, 0}}]}, 
          Text["y", {0, u + v, 0}], {Blue, 
            Line[{{0, 0, -(u/3)}, {0, 0, u}}]}, 
          Text["z", {0, 0, u + v}]}]; Axes3D[u_] := Axes3D[u, (u/8)]; Norm[a_?VectorQ] := N[(Sqrt[a . a])]; Normalize[a_?VectorQ] := If[a . a == 0, a, (a/Norm)[a]]; Perpend[a_?VectorQ] := 
      Normalize[{a[[2]], 
            -a[[1]]}] /; 
        Length[a] == 2Perpend[a_?VectorQ] := 
      Normalize[
          If[a[[1]] == 0, {1, 0, 0}, {0, 
              a[[3]], 
              -a[[2]]}]] /; 
        Length[a] == 3Base3D = 
      Table[{Cos[((2 k π)/8.) ], Sin[((2 k π)/8.) ]}, {k, 0, 
          8}]; Vector[from_?VectorQ, to_?VectorQ, opts___] := 
      Module[{sq, sw, ht, hs, hr, tr, ap, sf, vc, zvps, diff = to - from, 
            tip}, {sq, sw, ht, hs, hr, ts, tr, ap, sf, vc, zvps} = 
            {ShaftQ, ShaftWidth, HeadType, HeadSize, HeadRatio, TipSize, 
                  TipRatio, Aperture, ScaleFactor, VectorColor, 
                  ZeroVectorPointSize} /. {opts} /. Options[Vector]; 
          If[from == to, 
            Return[Graphics[{PointSize[zvps], vc, Point[from]}]]]; 
          diff = If[NumberQ[N[sf]], sf diff, sf[diff]]; tip = from + diff; 
          If[NumberQ[hs], hr = (hs/Norm)[diff]; tr = 0.75 hr]; 
          If[NumberQ[ts], tr = (ts/Norm)[diff]]; 
          Graphics[{
              If[sq, {vc, Thickness[sw], Line[{from, tip - tr diff}]}, {}], 
              With[{trans = ap hr Norm[diff] Perpend[diff]}, {vc, 
                  Thickness[sw], 
                  ht[{tip, tip - hr diff + trans, tip - tr diff, 
                      tip - hr diff - trans, tip}]}]}]] /; 
        Length[from] == Length[to] == 2Vector[from_?VectorQ, to_?VectorQ, opts___] := 
      Module[{sq, eq, sw, hs, hr, tr, ap, sf, vc, zvps, diff = to - from, 
            tip}, {sq, eq, sw, hs, hr, ap, sf, vc, zvps} = 
            {ShaftQ, EdgesQ, ShaftWidth, HeadSize, HeadRatio, Aperture, 
                  ScaleFactor, VectorColor, ZeroVectorPointSize} /. {opts}
                   /. Options[Vector]; 
          If[from == to, 
            Return[Graphics3D[{PointSize[zvps], vc, Point[from]}]]]; 
          diff = If[NumberQ[N[sf]], sf diff, sf[diff]]; tip = from + diff; 
          If[NumberQ[hs], hr = (hs/Norm)[diff]]; tr = (hr/2); 
          Graphics3D[{
              If[sq, {vc, Thickness[sw], Line[{from, tip - tr diff}]}, {}], 
              If[eq, {}, EdgeForm[]], {SurfaceColor[vc], 
                With[{temp = Perpend[diff]}, 
                  (Polygon[Append[#1, tip]]&)/@
                    Partition[
                      (tip - hr diff + #1&)/@
                        ((ap hr Norm[diff] Base3D) . {temp, 
                              Normalize[temp\[Cross]diff]}), 2, 1]]}}]] /; 
        Length[from] == Length[to] == 3Arrow[a_, Tail -> b_, opts___] := Vector[b, a + b, opts]Arrow[a_, opts___] := Vector[Table[0, {Length[a]}], a, opts]\(ArrowHead[a_, b_, opts___] := 
      Vector[a - b, a, ShaftQ -> False, opts]; 

End[]; 

    \(EndPackage[]; \)\)

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

Spherical Setup

\(Clear[polar]; 

    polar[{x_, y_, z_}] := {\@\(x\^2 + y\^2 + z\^2\), ArcTan[y\/x], 
        ArcCos[z\/\@\(x\^2 + y\^2 + z\^2\)]}; 
Clear[X, length]; 

    length[X_] := \@\(X . X\); 
\(rr = 3; \)\)R = 5; scale = 0.8; red = RGBColor[1, 0, 0]; blue = RGBColor[0, 0, 1]; color1 = RGBColor[0.8, 0.2, 0.8]; color2 = RGBColor[0.2, 0.8, 0.2]; black = RGBColor[0, 0, 0]; \(Clear[axes]; 

    axes := Graphics3D[{Line[{X, {1.5\ rr, 0, 0}}], 
          Line[{X, {0, 1.5\ rr, 0}}], Line[{X, {0, 0, 2\ rr}}]}]; 

    Clear[xyplane]; 

    xyplane := 
      Graphics3D[
        Polygon[{{\(-2\)\ rr, \(-2\)\ rr, 0}, {\(-2\)\ rr, 2\ rr, 0}, {2\ rr, 
              2\ rr, 0}, {2\ rr, \(-2\)\ rr, 0}}]]; 
\(X = {0, 0, 0}; \)\)origin = Graphics3D[{black, Point[X]}]; Z = {2, 3, 5}; \(Clear[point]; 

    point := Graphics3D[{red, PointSize[0.03], Point[scale\ Z]}]; 

    \(Z0 = {0, 0, length[0.8\ Z]}; \)\)\(Clear[zpoint]; 
zpoint = Graphics3D[{black, Point[Z0]}]; 

    \(XY = scale\ Z\ {1, 1, 0}; \)\)\(Clear[xypoint]; 
xypoint := Graphics3D[{black, Point[XY]}]; 

    \(X0 = {length[scale\ Z\ {1, 1, 0}], 0, 0}; \)\)xpoint = Graphics3D[{black, Point[X0]}]; Y0 = {0, length[scale Z {1, 1, 0}], 0}; ypoint = Graphics3D[{black, Point[Y0]}]; \(Clear[ray]; 
ray := Graphics3D[{blue, Line[{X, scale\ Z}]}]; 

    Clear[ray1]; 
ray1 := Graphics3D[{color1, Line[{scale\ Z, Z}]}]; 

    Clear[xyray]; 
xyray := Graphics3D[{red, Line[{X, Z\ {1, 1, 0}}]}]; 

    \(rays := {ray, xyray}; \)\)xyaux = 
      (length[0.8 Z] (0.8 Z {1, 1, 0}))/
        length[0.8 Z {1, 1, 0}]; \(Clear[zarc]; 

    zarc = Graphics3D[{blue, 
          Line[Table[
              \(Cos[t]\ \) {0, 0, length[0.8\ Z]} + Sin[t]\ xyaux, {t, 0, 
                \(polar[0.8\ Z]\)[[3
                  ]],  .1}]]}]; 
Clear[zarc1]; 

    zarc1 = Graphics3D[{color1, 
          Line[Table[
              \(Cos[t]\ \) {0, 0, length[0.8\ Z]} + Sin[t]\ xyaux, {t, 
                \(polar[0.8\ Z]\)[[3]], 
                1,  .1}]]}]; 
Clear[zarc2]; 

    zarc2 = Graphics3D[{color1, 
          Line[Table[
              \(Cos[t]\ \) {0, 0, length[0.8\ Z]} + Sin[t]\ xyaux, {t, 
                \(-0.8\), 0,  .1}]]}]; 
Clear[xyarc]; 

    xyarc = Graphics3D[{blue, 
          Line[Table[
              Cos[t]\ X0 + Sin[t]\ Y0, {t, 0, 
                \(polar[XY]\)[[2
                  ]],  .1}]]}]; 
Clear[xyarc1]; 

    xyarc1 = Graphics3D[{color1, 
          Line[Table[Cos[t]\ X0 + Sin[t]\ Y0, {t, \(- .5\), 0,  .1}]]}]; 

    Clear[xyarc2]; 

    xyarc2 = Graphics3D[{color1, 
          Line[Table[
              Cos[t]\ X0 + Sin[t]\ Y0, {t, 
                \(polar[XY]\)[[2]], 
                \(polar[XY]\)[[2]] + 
                  0.3,  .1}]]}]; 
Clear[stick]; 

    stick = Graphics3D[{red, Line[{scale\ Z, XY}]}]; 

    \(xaxislabel = Text["x", {0.363, 0.26}]; \)\)yaxislabel = Text["y", {0.73, 0.3}]; zaxislabel = Text["z", { .5, 0.67}]; stickplot = 
      Show[xyplane, axes, ray, point, Boxed -> False, 
        ViewPoint -> {2.747, 1.594, 1.168}, 
        Epilog -> {xaxislabel, yaxislabel, zaxislabel}, 
        DisplayFunction -> Identity]; rho = Text["r", {0.53, 0.45}]; rlabel = 
      Show[xyplane, axes, ray, point, Boxed -> False, 
        ViewPoint -> {2.747, 1.594, 1.168}, 
        Epilog -> {rho, xaxislabel, yaxislabel, zaxislabel}, 
        DisplayFunction -> Identity]; phi = Text["s", {0.55, 0.57}]; slabel = 
      Show[xyplane, zpoint, axes, ray, point, zarc, zarc1, zarc2, 
        Boxed -> False, ViewPoint -> {2.747, 1.594, 1.168}, 
        Epilog -> {phi, xaxislabel, yaxislabel, zaxislabel}, 
        DisplayFunction -> Identity]; theta = Text["t", { .5, 0.3}]; tlabel = 
      Show[xyplane, axes, xypoint, xpoint, ray, stick, point, xyarc, xyarc1, 
        xyarc2, Boxed -> False, ViewPoint -> {2.747, 1.594, 1.168}, 
        Epilog -> {theta, xaxislabel, yaxislabel, zaxislabel}, 
        DisplayFunction -> Identity]; all = 
      Show[xyplane, axes, ray, stick, point, zpoint, xpoint, xypoint, xyarc, 
        xyarc1, xyarc2, zarc, zarc1, zarc2, Boxed -> False, 
        ViewPoint -> {2.747, 1.594, 1.168}, 
        Epilog -> {theta, phi, rho, xaxislabel, yaxislabel, zaxislabel}, 
        DisplayFunction -> Identity];

Crisscross

\(Clear[x]; 

    crisscross = 
      Plot[{Cos[x], Sin[x]}, {x, π\/8, \(3\ π\)\/8}, 
        PlotStyle -> {{RGBColor[1, 0, 0], Thickness[0.02]}}, 
        Axes -> None, AspectRatio -> 1\/3, 
        DisplayFunction -> Identity]; \)

L.1)

You are faced with a hand calculation of
       (∫_^)(∫_( R)^) 
          ((x^2) +  (y^2) ) dx dy,
where R is the two-dimensional region consisting of everything inside and on the circle 
       (x^2) +  (y^2) = 9.
Switch paper by using polar coordinates
       x = r Cos[t], and
       y = r Sin[t],
and then calculate the integral.

L.2)

You are faced with a hand calculation of 
       (∫_^)(∫_( R)^) 
          x dx dy, 
where R is the two-dimensional region consisting of everything bounded by the lines 
       x +  y = 0, x +  y = 1, 
       x -  y = 0, and x -  y = 1.  
This is just a little nasty, because doing it without going to better paper involves solving some equations, and then doing two separate integrals.
Switch to paper on which you can evaluate this with one sweet integral and then calculate its value.

L.3)

Here's a plot of the part of the surface
       z = (e^(-((x^2)  +  (((y/2))^2))))
above the everything inside and on the ellipse 
       (x^2) + (((y/2))^2) = 1 
in the xy-plane:

\(Clear[x, y, r, t]; 
    
{x[r_, t_], y[r_, t_]} = {r\ Cos[t], 2\ r\ Sin[t]}; 

    \({{rlow, rhigh}, {tlow, thigh}} = {{0, 1}, {0, 2\ π}}; \)\)surfaceplot = 
      ParametricPlot3D[{x[r, t], y[r, t], 
          (E^(-(x[r, t]^2 + ((((1/2) y[r, t]))^2))))}, {r, rlow, 
          rhigh}, {t, tlow, thigh}, PlotPoints -> {Automatic, 36}, 
        DisplayFunction -> Identity]; Rplot = 
      ParametricPlot3D[{x[r, t], y[r, t], 0}, {r, rlow, rhigh}, {t, tlow, 
          thigh}, PlotPoints -> {2, 36}, 
        DisplayFunction -> Identity]; Show[surfaceplot, Rplot, 
      Graphics3D[Text["R", 0.8 {(1/(Sqrt[2])), (1/(Sqrt[2])), 0}]], 
      AxesLabel -> {"x", "y", "z"}, 
      ViewPoint -> CMView, DisplayFunction -> $DisplayFunction];

By hand calculation, measure the volume, 
       (∫_^)(∫_( R)^) 
          (e^(-((x^2)  +  (((y/2))^2)))) dx 
            dy,
of the solid whose top skin is the surface plotted above, and whose base is everything on the xy-plane directly below this surface, by transforming to more favorable paper.
Remember that Sin[t]^( 2) +  Cos[t]^( 2) = 1.

L.4)

The area conversion factor (Subscript[A, xy])[u, v] is the absolute value of the determinant of a matrix composed of what two gradient vectors?

L.5)

All the plots below give information about the same phenomenon, about what happens when you plot the region within the uv-paper rectangle consisting of all points {u, v} with 
       -2 ≤ u ≤ 2 and (1/2) ≤ v ≤ 4 
on xy-paper for 
       x[u, v] = ArcTan[u] and y[u, v] = Log[(u^2) +  v].
Interpret the information conveyed by each plot.

\(Clear[x, y, u, v, gradx, grady, Axy]; 
x[u_, v_] = ArcTan[u]; 

    \(y[u_, v_] = Log[u\^2 + v]; \)\)\(gradx[u_, v_] = {D[x[u, v], \ u], D[x[u, v], \ v]}; 

    grady[u_, v_] = {D[y[u, v], \ u], D[y[u, v], \ v]}; 

    Axy[u_, v_] = Det[{gradx[u, v], grady[u, v]}]\)

ContourPlot[Axy[u, v], {u, -2, 2}, {v, (1/2), 4}];

\(Clear[sizer]; 
scalefactor = 0.1; 

    \(sizer[u_, v_] = scalefactor\ \@Axy[u, v]; \)\)\(Clear[k]; 

    uvpoints = 
      Table[{Random[Real, {\(-2\), 2}], Random[Real, {1\/2, 4}]}, {k, 1, 
          300}]; 
\(Show[
      Table[Graphics[{
            PointSize[
              sizer@@uvpoints[[k]]], 
            Point[uvpoints[[k]]]}], {k, 
          1, 300}], Axes -> True, AxesLabel -> {"u", "v"}]; 
    \)\)

\(Clear[gradAxy]; 

    gradAxy[u_, v_] = {D[Axy[u, v], \ u], D[Axy[u, v], \ v]}; 

    scalefactor = 0.4; 

    \(Show[Table[
        Arrow[scalefactor\ gradAxy[u, v], Tail -> {u, v}], {u, \(-2\), 
          2, 1\/4}, {v, 1\/2, 4, 1\/4}], Axes -> Automatic]; \)\)

Plot3D[Axy[u, v], {u, -2, 2}, {v, (1/2), 4}, 
      PlotPoints -> 30, ViewPoint -> CMView, 
      AxesLabel -> {"u", "v", "Axy[u,v]"}, 
      PlotRange -> All];

L.6)

Say how to linearize a function f[x, y] at a point {a, b}, and discuss how well the linearized version of f[x, y] at {a, b} approximates f[x, y] near {a, b}.
Does the quality of the approximation improve or deteriorate as you go closer and closer to {a, b}?

L.7)

Briefly explain how linearizations can be used to come up with the formula for the area conversion factor.

L.8)

Look at:

\(Clear[u, v, x, y]; 
{x[u_, v_], y[u_, v_]} = {3\ u\^2, u\^2 + v\^2}; 

    Clear[gradx, grady, Axy]; 

    gradx[u_, v_] = {D[x[u, v], \ u], D[x[u, v], \ v]}; 

    grady[u_, v_] = {D[y[u, v], \ u], D[y[u, v], \ v]}; 

    Axy[u_, v_] = Det[{gradx[u, v], grady[u, v]}]\)

The uv-paper circle 
       (((u -  1))^2) + (((v - 1))^2) = 2 
goes right through {0, 0}:

\(Clear[t]; 

    ParametricPlot[{1 + \@2\ Cos[t], 1 + \@2\ Sin[t]}, {t, 0, 2\ π}, 
      PlotStyle -> {{Thickness[0.01]}}, AspectRatio -> Automatic, 
      AxesLabel -> {"u", "v"}]; \)

Now look at the plot of this circle on xy-paper with x[u, v] and y[u, v] as given above:

\(Clear[t]; 

    ParametricPlot[{x[1 + \@2\ Cos[t], 1 + \@2\ Sin[t]], 
        y[1 + \@2\ Cos[t], 1 + \@2\ Sin[t]]}, {t, 0, 2\ π}, 
      PlotStyle -> {{Thickness[0.01]}}, PlotRange -> All, 
      AxesLabel -> {"x", "y"}]; \)

Why do you think the corner popped up when you went from xy-paper to uv-paper?

L.9)

To calculate the net flow of a vector field 
       Field[x, y] = {m[x, y], n[x, y]} 
across the boundary C of a region R, you have your choice:
-> You can go to the labor of parameterizing C and then calculate 
       (∮_( C)) -n[x, y] dx  +  
        m[x, y] dy.
-> Or, if the field has no singularities inside R, you can put 
       divField[x, y] = D[m[x, y], x] +  D[n[x, y], y], 
and calculate the 2D integral
       (∫_^)(∫_( R)^) 
          divField[x, y] dx dy.
Here's a vector field:

\(Clear[x, y, m, n, Field]; 
    
{m[x_, y_], n[x_, y_]} = {\(-x\^2\) + Cos[y], E\^x + y\^2}; \)

Agree that R is everything inside and on the parallelogram you see below:

Plot[{-x, -x + 3, 0.5 x, 0.5 x + 4}, {x, -2.67, 2.0}, 
      PlotStyle -> {{Thickness[0.01]}}, PlotRange -> {0, 3.68}, 
      AspectRatio -> Automatic, AxesLabel -> {"x", "y"}];

Transform the 2D integral
       (∫_^)(∫_( R)^)  
          divField[x, y] dx dy
to favorable uv-paper to measure the net flow of this vector field across the parallelogram.  Is the net flow of this vector field across the boundary of this parallelogram from outside to inside, or inside to outside?

L.10)

To calculate the net flow of a vector field 
       Field[x, y] = {m[x, y], n[x, y]}
along the boundary C of a region R, you have your choice:
-> You can go to the labor of parameterizing C, and then calculate 
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
-> or if the field has no singularities inside R, you can put 
       rotField[x, y] = D[n[x, y], x] -  D[m[x, y], y], 
and calculate the 2D integral
       (∫_^)(∫_( R)^) 
          rotField[x, y] dx dy.
Here's a vector field:

\(Clear[x, y, m, n, Field]; 
    
{m[x_, y_], n[x_, y_]} = {\((y - 2)\)\^2, x - y}\)

Agree that R is everything inside the parallelogram plotted in the last problem.
Transform the 2D integral
       (∫_^)(∫_( R)^) 
          rotField[x, y] dx dy
to favorable uv-paper to measure the net flow of this vector field along the parallelogram.  Is the net flow of this vector field along this parallelogram clockwise or counterclockwise?

L.11)

When you start with the ellipse
       ((((x/a)))^2)+((((y/b)))^2)=(r^2) 
on xy-paper and you go to uv-paper using 
       u[x, y]=(x/a), and
       v[x, y]=(y/b), 
then the xy-ellipse plots out as the circle 
       (u^2) +  (v^2) = (r^2).
On uv-paper, the area enclosed by this circle measures out to
       π (r^( 2)) 
square units.  
Calculate the area conversion factor (Subscript[A, uv])[x, y], and use the result to explain why the xy-area measurement of the region enclosed by the ellipse 
       ((((x/a)))^2)+((((y/b)))^2)=(r^( 2)) 
is
       π a b (r^( 2)) 
square units.