VC.06 Sources,  Sinks,  Swirls and Singularities
GIVE IT A TRY!

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

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

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]; \)

G.1)  Sources, sinks and swirls*

G.1.a.i)

Go with 
       Field[x, y] = {(E^x) Sin[y], (E^x) Cos[y]}.
Calculate 
       divField[x, y] 
and use the result to say why the net flow of Field[x, y] across any closed curve is 0.

G.1.a.ii)

Go with 
       Field[x, y] = {x, y}.
Calculate 
       divField[x, y] 
and use the result to say why the net flow of Field[x, y] across any closed curve is from inside to outside.

G.1.b.i)

Go with 
       Field[x, y] = {(e^x) Sin[y], (e^x) Cos[y]}.
Calculate 
       rotField[x, y] 
and use the result to say why the net flow of Field[x, y] along any closed curve is 0.

G.1.b.ii)

Go with 
       Field[x, y] = {y, -x}.
Calculate 
       rotField[x, y]
and use the result to say why the net flow of Field[x, y] along any closed curve is clockwise.

G.1.c)

Here is the rectang1e R with corners at 
       {-1, -2}, {5, -2}, {5, 2}, and {-1, 2}:

Rplot = 
      Show[Graphics[{Red, Thickness[0.01], 
            Line[{{-1, -2}, {5, -2}, {5, 2}, {-1, 2}, {
                  -1, -2}}]}], Axes -> True, 
        AxesLabel -> {"x", "y"}];

Use the formula
       (∮_( C)) -n[x, y] dx  +  
        m[x, y] dy
        = 
        (∫_^)(∫_( R)) 
            divField[x, y] dx dy
to measure the net flow of the vector field 
       Field[x, y] = {(x^2) + 2  (y^2), (x^2) - 2  (y^2)} 
across the boundary curve C of R.  Is the net flow of this vector field across C from outside to inside, or is it from inside to outside?
Next, use the formula
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
        = 
        (∫_^)(∫_( R)^) 
            (D[n[x, y], x]  -  D[m[x, y], y]) dx 
              dy.
to measure the net flow of the vector field 
       Field[x, y] = {(x^2) + 2  (y^2), (x^2) - 2  (y^2)} 
along the boundary curve C of R. Is the net flow of this vector field along C counterclockwise or clockwise?

G.1.d.i)

Here's a vector field:

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


    Field[x_, y_] = {m[x, y], n[x, y]}; \)

Give a sample plot of some of the sources in this vector field.

G.1.d.ii)

Go with the same vector field as in part i) immediately above and look at this plot:

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

    \(Field[x_, y_] = {m[x, y], n[x, y]}; \)\)\(Clear[divField]; 
divField[x_, y_] = D[m[x, y], x] + D[n[x, y], y]; 

    divplot = 
      Plot3D[divField[x, y], {x, \(-5\), 5}, {y, \(-5\), 5}, 
        PlotPoints -> {25, 25}, DisplayFunction -> Identity]; 

    \(xyplane = 
      Graphics3D[
        Polygon[{{\(-5\), \(-5\), 0}, {\(-5\), 5, 0}, {5, 5, 0}, {5, \(-5\), 
              0}}]]; 


    Show[divplot, xyplane, AxesLabel -> {"x", "y", "z"}, 
      ViewPoint -> CMView, DisplayFunction -> $DisplayFunction]; 
    \)\)

How is this plot related to the plot you did in part d.i) immediately above?

G.1.e.i)

Here's another vector field:

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

    Field[x_, y_] = {m[x, y], n[x, y]}\)

Give a sample plot of some of the points at which this vector field swirls in the counterclockwise direction.

G.1.e.ii)

Go with the same vector field as in part e.i) immediately above and look at this plot:

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

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

    rotplot = 
      Plot3D[rotField[x, y], {x, \(-5\), 5}, {y, \(-5\), 5}, 
        PlotPoints -> {10, 30}, DisplayFunction -> Identity]; 

    \(xyplane = 
      Graphics3D[
        Polygon[{{\(-5\), \(-5\), 0}, {\(-5\), 5, 0}, {5, 5, 0}, {5, \(-5\), 
              0}}]]; 


    Show[rotplot, xyplane, AxesLabel -> {"x", "y", "z"}, 
      ViewPoint -> CMView, DisplayFunction -> $DisplayFunction]; 
    \)\)

How is this plot related to the plot you did in part e.i) immediately above?

G.2)  Singularity sources, sinks and swirls*

G.2.a) Singularity sources and sinks

Given a vector field 
       Field[x, y] = {m[x, y], n[x, y]}, 
you can calculate 
       divField[x, y] = D[m[x, y], x] +  D[n[x, y], y] 
to look for sources and sinks.
If you locate a source at {x, y} and {x, y} is not a singularity, you can expect new fluid to be slowly oozing into the flow at {x, y}.
If you locate a sink at {x, y} and {x, y} is not a singularity, you can expect old fluid to be slowly soaking out of the flow at {x, y}.
The vivid sources and sinks are often found at singularities; in fact if you envision a sink at a singularity to be a black hole, you are thinking correctly.
To detect a source or a sink at a singularity, you center a small circle C[r] of radius r at the singularity and calculate
       (∮_( C[r])) -n[x, y] dx  +  
        m[x, y] dy.
-> If
       (lim_(r  ->  0)) 
            (∮_( C[r])) 
              -n[x, y] dx  +  
          m[x, y] dy > 0,
you have located a singularity source (a gusher) at the singularity.
-> If
       (lim_(r  ->  0)) 
            (∮_( C[r])) 
              -n[x, y] dx  +  
          m[x, y] dy < 0,
you have located a singularity sink (a black hole) at the singularity.
-> If
       (lim_(r  ->  0)) 
            (∮_( C[r])) 
              -n[x, y] dx  +  
          m[x, y] dy = 0,
you have located a singularity that is neither a source nor a sink.
Try it out:
The point {a, b} is a singularity of the 2D electric field coming from a point charge of strength 2 placed at {a, b}:

\(Clear[ElectricField, a, b, m, n, q, x, y]; 
    
{m[x_, y_], n[x_, y_]} = 
      \(q\ {x - a, y - b}\)\/\(\((x - a)\)\^2 + \((y - b)\)\^2\); 

    ElectricField[x_, y_] = {m[x, y], n[x, y]}\)

Center a circle C[r] of radius r at {a, b} and calculate
       (∮_( C[r])) -n[x, y] dx  +  
        m[x, y] dy:

singularity = {a, b}; Clear[xr, yr, r, t];
{xr[t_], yr[t_]} = singularity + r {Cos[t], Sin[t]};

(∫_0^(2 π))(-n[xr[t], yr[t]] xr'[t]+m[xr[t], yr[t]] yr'[t])\[DifferentialD]t

This tells you that the singularity at {a, b} is a source of new juice if q > 0 (positive charge at {a, b}) and is a sink for old juice if q < 0 (negative charge at {a, b}).

G.2.a.i)

Does the electric field above have sources or sinks other than at the singularity?

Look at:

Together[D[m[x, y], x] + D[n[x, y], y]]

G.2.a.ii)

Here's a vector field related to the electric field:

\(Clear[Field, a, b, m, n, x, y]; 
    
{m[x_, y_], n[x_, y_]} = 
      \(5\ {x - a, y - b}\)\/\@\(\((x - a)\)\^2 + \((y - b)\)\^2\); 

    Field[x_, y_] = {m[x, y], n[x, y]}\)

Note the singularity at {a, b}.
Now look at the following information:

singularity = {a, b}; Clear[xr, yr, r, t];
{xr[t_], yr[t_]} = singularity + r {Cos[t], Sin[t]};

(∫_0^(2 π))(-n[xr[t], yr[t]] xr'[t]+m[xr[t], yr[t]] yr'[t])\[DifferentialD]t

How does this help to tell you that the singularity at {a, b} is neither a singularity source nor a singularity sink?

G.2.a.iii)

Stay with the same vector field as in part ii) above and look at divField[x, y] together with  
       (((x -  a))^2) +  (((y -  b))^2):

\(Clear[Field, a, b, m, n, x, y]; 
    
{m[x_, y_], n[x_, y_]} = 
      \(5\ {x - a, y - b}\)\/\@\(\((x - a)\)\^2 + \((y - b)\)\^2\); 

    \(Field[x_, y_] = {m[x, y], n[x, y]}; \)\){Together[D[m[x, y], x] + D[n[x, y], y]], 
      Expand[(((x - a))^2) + (((y - b))^2)]}

How does this help to tell you that all points {x, y} other than the singularity at {a, b} are sources?
How does this tell you that the big-time sources of new fluid for this field are packed near the singularity?

G.2.a.iv)

Here's another vector field related to the electric field:

\(Clear[Field, a, b, q, m, n, x, y]; 
    
{m[x_, y_], n[x_, y_]} = 
      \(7\ {x - a, y - b}\)\/\((\((x - a)\)\^2 + \((y - b)\)\^2)\)\^\(3/2\); 
    
Field[x_, y_] = {m[x, y], n[x, y]}\)

Determine whether {a, b} is a singularity source, a singularity sink, or neither.
Also determine whether there are sources or sinks other than at the singularity.

G.2.b.i) Singularity swirls

When you pull the plug in a bathtub, you see a good example of a singularity swirl (and a singularity sink).
To detect a singularity swirl, you center a small circle C[r] of radius r at the singularity and calculate a limit of a certain path integral. If this limit is positive, then you have located a counterclockwise singularity swirl. If this limit is negative, then you have located a clockwise singularity swirl.
If this limit is 0, then you have located singularity that has no swirling effect at all.
What limit do you look at?

G.2.b.ii)

Here's a vector field with a singularity at {0, 0}:

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

    Field[x_, y_] = {m[x, y], n[x, y]}\)

Here is rotField[x, y]:

rotField[x, y] = Together[D[n[x, y], x] - D[m[x, y], y]]

This field has no swirl around any point other than possibly the singularity at {0, 0}.
Look at a plot of this vector field.

scalefactor = 2; \(fieldplot = 
      Table[Arrow[Field[x, y], Tail -> {x, y}, 
          ScaleFactor -> scalefactor], {x, \(-4.5\), 4.5, 9\/5}, {y, 
          \(-4.5\), 4.5, 9\/5}]; 

    \(Show[fieldplot, Axes -> True, AxesLabel -> {"x", "y"}]; 
    \)\)

Big-time clockwise singularity swirl around the singularity at {0, 0}.
Test your answer to part b.i) immediately above to see whether your limit agrees with reality.

G.3)  Agree or disagree*

Indicate your agreement or disagreement with each of the following statements and paragraphs.  When you disagree, say why you disagree.
When you agree, feel free to say why you agree, but you are under no obligation to do so.

G.3.a)

If Field[x, y] = {m[x, y], n[x, y]} has no sinks, sources, or singularities within a closed curve C, then the net flow of Field[x, y] across C must be 0.

G.3.b)

If Field[x, y] = {m[x, y], n[x, y]} has no singularities within a closed curve C, and rotField[x, y] = 0 at all points within C, then the net flow of Field[x, y] along C is 0.

G.3.c)

If Field[x, y] = {m[x, y], n[x, y]} has no singularities and has the property that rotField[x, y] = 0 at all points {x, y}, then Field[x, y] is guaranteed to be a gradient field.

Go back one lesson and look up the two parts of the gradient test.

G.3.d)

Here is a vector field:

\(Clear[m, n, x, y]; 
{m[x_, y_], n[x_, y_]} = {x\^3, y\^3}; 

    Field[x_, y_] = {m[x, y], n[x, y]}\)

No singularities anywhere.
Look at divField[x, y]:

D[m[x, y], x] + D[n[x, y], y]

This is always positive except when {x, y} = {0, 0}. 
As a result, every {x, y} other than {0, 0} is a source for Field[x, y].  Consequently, if C is any closed curve (like a deformed circle), then the net flow of Field[x, y] across C is from inside to outside.
After all, it cannot be from outside to inside because there are no sinks inside C to absorb the excess fluid.

G.3.e)

Here are two curves:

\(Clear[x1, y1, x2, y2, t]; 
    
{x1[t_], y1[t_]} = 0.7\ {2\ Cos[t], Sin[t]}; 

    \({x2[t_], y2[t_]} = 1.2\ {2\ Cos[t], Sin[t] + 1\/4\ Sin[4\ t]}; \)\)curveplots = 
      ParametricPlot[{{x1[t], y1[t]}, {x2[t], y2[t]}}, {t, 0, 2 π}, 
        PlotStyle -> {{Thickness[0.01], Red}}, 
        DisplayFunction -> Identity]; \(label = {Graphics[Text["C1", {1, 0.4}]], 
        Graphics[Text["C2", {2, 0.75}]]}; 


    Show[curveplots, label, PlotRange -> All, Axes -> True, 
      AxesLabel -> {"x", "y"}, AspectRatio -> Automatic, 
      DisplayFunction -> $DisplayFunction]; \)

Suppose Field[x, y] = {m[x, y], n[x, y]} has the properties that 
-> all the singularities of Field[x, y] are inside (Subscript[C, 1]),
-> (∮_( (Subscript[C, 1]))) -n[x, y] dx  +  
          m[x, y] dy > 0, and
-> divField[x, y] = D[m[x, y], x] +  D[n[x, y], y] > 0
at all points {x, y} between (Subscript[C, 1]) and (Subscript[C, 2]). 
This tells you that all points {x, y} between (Subscript[C, 1]) and (Subscript[C, 2]) are sources for the flow corresponding to Field[x, y].  As a result,
       \(∮\_\(\ C\_1\)\ \(-n[x, y]\) dx\  + \ 
          m[x, y] dy < 
	\ \ \ \ 
        ∮\_\(\ C\_2\)\ \(-n[x, y]\) dx\  + \ 
          m[x, y] dy\) 
so that the flow of Field[x, y] across (Subscript[C, 2]) must be greater than the flow of Field[x, y] across (Subscript[C, 1]).

G.3.f)

Suppose Field[x, y] = {m[x, y], n[x, y]} has exactly two singularities in the region R enclosed by a closed curve C.  Also suppose that (Subscript[C, 1]) is a closed curve running totally within R.  If Field[x, y] has no sinks, sources, or singularities between C and (Subscript[C, 1]), then the net flow of Field[x, y] across C equals the net flow of Field[x, y] across (Subscript[C, 1]).

G.3.g)

Here's a closed curve C:

Cplot = 
      Graphics[{Thickness[0.01], Red, 
          Line[{{6, 0}, {1, 1}, {0, 6}, {-1, 1}, {-6, 0}, {-1, 
                -1}, {0, -6}, {1, -1}, {6, 0}}]}]; \(label = Graphics[Text["C", {0.8, 3.5}]]; 


    Show[Cplot, label, Axes -> True, AxesLabel -> {"x", "y"}, 
      AspectRatio -> Automatic]; \)

And here's a vector field:

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

Note the singularity at {0, 0}. 
This tells you that you can calculate the flow of Field[x, y] across C by calculating
       (∮_( (Subscript[C, 1]))) -n[x, y] dx  +  
        m[x, y] dy
where (Subscript[C, 1]) is a small circle centered at {0, 0}.

Tip:

Before you leap on this one, check to see whether there are sources or sinks between the singularity and C.

Together[D[m[x, y], x] + D[n[x, y], y]]

G.4)  Flow calculations in the presence of singularities*

G.4.a)

How can you tell without evaluating any path integral that the flow of the vector field
       Field[x, y]={((2 x)/((x^2) +  (y^2))),((2 y)/((x^2) +  (y^2)))}
across the circle (x^2) +  (y^2) = (r^2) is the same as its flow across any ellipse ((((x/a)))^2)+((((y/b)))^2)=1?

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

Together[D[m[x, y], x] + D[n[x, y], y]]

G.4.b.i)

Look at the following curve C:

Cplot = 
      Graphics[{Thickness[0.01], Red, 
          Line[{{2, 0}, {1, 3}, {4, 3}, {5, 5}, {-1, 6}, {0, 4}, {-1, 
                0}, {-3, -3}, {- .3, -1}, {2, -3}, {2, 
                0}}]}]; \(label = Graphics[Text["C", {3.5, 5}]]; 


    Show[Cplot, label, Axes -> True, AxesLabel -> {"x", "y"}]; 
    \)

Why would only a dweeb measure the net flow of
       Field[x, y] = {-((4 x)/((x^2) +  (((y  -  2))^2))), 
          -((4 (y  -  2))/((x^2) +  (((y  -  2))^2)))}
          
across C by parameterizing C and calculating the path integral?
Remove yourself from the dweeb class by measuring the net flow of this vector field across C by measuring the net flow of this vector field across a convenient substitute curve.
Is the net flow of this vector field across C from inside to outside, or is it from outside to inside?

G.4.b.ii)

Go with the same curve C as above:

Show[Cplot, label, Axes -> True, AxesLabel -> {"x", "y"}];

You are asked to measure the net flow of
       Field[x, y] = {
          ((4 (x +  2))/((((x +  2))^2) +  (((y  -  2))^2))), 
          ((4 (y  -  2))/((((x +  2))^2) +  (((y  -  2))^2)))}
          
across C.
You weren't born yesterday; so you look at:

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

    \(Field[x_, y_] = {m[x, y], n[x, y]}; \)\)divField[x_, y_] = Together[D[m[x, y], x] + D[n[x, y], y]]

And then you announce that the net flow of this vector field across C is 0. You are right.
Why are you right?

G.5)  2D electric fields, dipole fields, and Gauss's law in physics*

G.5.a)

When you put a charge proportional to a number q at a point {a, b}, the resulting two-dimensional electrical field is:

\(Clear[x, y, a, b, q, Electfield]; 

    Electfield[x_, y_, a_, b_, q_] = 
      \(q\ {x - a, y - b}\)\/\(\((x - a)\)\^2 + \((y - b)\)\^2\)\)

Here's a plot in the case {a, b} = {1.25, 0.25} and q = 2:

a = 1.25; b = 0.25; q = 2; hotpoint = Graphics[{PointSize[0.06], Red, Point[{a, b}]}]; scalefactor = 0.4; \(fieldplot = 
      Table[Arrow[Electfield[x, y, a, b, q], Tail -> {x, y}, 
          ScaleFactor -> scalefactor], {x, \(-2\), 4, 0.5}, {y, \(-3\), 
          3, 0.5}]; 


    Show[hotpoint, fieldplot, Axes -> True, 
      AxesLabel -> {"x", "y"}]; \)

Describe what you see.

G.5.b)

Here are the divergence and the rotation of the electric field resulting from a point charge of strength q placed at {a, b}:

\(Clear[x, y, a, b, q, Electfield, m, n, divElectfield, rotElectfield]; 

    Electfield[x_, y_, a_, b_, q_] = 
      \(q\ {x - a, y - b}\)\/\(\((x - a)\)\^2 + \((y - b)\)\^2\)\)

{m[x_, y_], n[x_, y_]} = Electfield[x, y, a, b, q]; divElectfield[x_, y_] = Simplify[D[m[x, y], x] + D[n[x, y], y]]

rotElectfield[x_, y_] = Simplify[D[n[x, y], x] - D[m[x, y], y]]

Does this electric field have sources or sinks at points other than {a, b}?
How do you know?
What is the net flow of this electric field across any closed curve without loops that does not wrap around the singularity at {a, b}?

G.5.c)

Here is the measurement of the flow of the electric field across any circle of radius r centered at {a, b}.

\(Clear[x, y, a, b, q, Electfield, m, n]; 

    Electfield[x_, y_, a_, b_, q_] = 
      \(q\ {x - a, y - b}\)\/\(\((x - a)\)\^2 + \((y - b)\)\^2\); 

    \({m[x_, y_], n[x_, y_]} = Electfield[x, y, a, b, q]; \)\){x[t_], y[t_]} = {a, b} + r {Cos[t], Sin[t]};

(∫_0^(2 π))(-n[x[t], y[t]] x'[t]+m[x[t], y[t]] y'[t])\[DifferentialD]t

Usually when the divergence of a vector field is 0, then its flow across any closed curve is 0.  But this is not true here for closed curves wrapping around {a, b} because of the singularity (blow up) of the electric field at {a, b}.
What is the flow of the electric field across any closed curve without loops that wraps around the singularity at {a, b}?

G.5.d) Dipoles

A dipole can be approximated by two charges of the same magnitude but opposite sign separated by a small distance.
Dipoles are especially important in atomic theory.  The great scientist Richard Feynman explained it this way:

Here is a plot of the dipole electrical field resulting from a positive charge at {0.25, 0} and the opposite charge of the same magnitude at {-0.25, 0}.

\(Clear[x, y, a, b, q, Electfield, m, n]; 

    Electfield[x_, y_, a_, b_, q_] = 
      \(q\ {x - a, y - b}\)\/\(\((x - a)\)\^2 + \((y - b)\)\^2\); 

    \({aplus, bplus} = {0.25, 0}; \)\){aminus, bminus} = {-0.25, 0}; q = 2; \(singularitysource = 
      Graphics[{PointSize[0.04], Red, Point[{aplus, bplus}]}]; 

    singularitysink = 
      Graphics[{PointSize[0.04], CadmiumOrange, Point[{aminus, bminus}]}]; 

    dipoleplot = 
      Table[Arrow[
          \((Electfield[x, y, aplus, bplus, q] + 
              Electfield[x, y, aminus, bminus, \(-q\)])\), 
          Tail -> {x, y}, ScaleFactor -> Normalize, 
          HeadSize -> 0.3], {x, \(-3.1\), 2.9, 0.5}, {y, \(-3.1\), 2.9, 
          0.5}]; 


    Show[singularitysource, singularitysink, dipoleplot, Axes -> True, 
      AxesLabel -> {"x", "y"}, 
      PlotLabel -> "Dipole electric field"]; \)

The dipole electric field pictured above is given by the sum of the individual electric fields:

\(Clear[x, y, a, b, q, Electfield, m, n]; 

    Electfield[x_, y_, a_, b_, q_] = 
      \(q\ {x - a, y - b}\)\/\(\((x - a)\)\^2 + \((y - b)\)\^2\); 

    \({aplus, bplus} = {0.25, 0}; \)\){aminus, bminus} = {-0.25, 0}; \(Clear[Dipole]; 

    Dipole[x_, y_] = 
      Electfield[x, y, aplus, bplus, q] + 
        Electfield[x, y, aminus, bminus, \(-q\)]\)

Report on:
-> divDipole[x, y]
-> rotDipole[x, y]
-> The flow of Dipole[x, y] across the square with corners at {-1, -1}, {1, -1}, {1, 1} and {-1, 1}.
-> The flow of Dipole[x, y] across any closed curve without loops enclosing both of the singularites at {aplus, bplus} and {aminus, bminus}.

G.5.e.i) Lots of point charges

You can build intricate electric fields by taking n different points 
       {(Subscript[a, 1]), (Subscript[b, 1])}, {(Subscript[a, 2]), (Subscript[b, 2])}, …, {(Subscript[a, n]), (Subscript[b, n])} 
and placing point charges of strength 
       (Subscript[q, 1]) at {(Subscript[a, 1]), (Subscript[b, 1])},
       (Subscript[q, 2]) at {(Subscript[a, 2]), (Subscript[b, 2])},
       … , and
       (Subscript[q, n]) at {(Subscript[a, n]), (Subscript[b, n])}.
The strengths (Subscript[q, 1]), (Subscript[q, 2]), … , and (Subscript[q, n]) can be positive (singularity sources) or negative (singularity sinks).
The combined electric field resulting from this placement of point charges is the sum of the individual electric fields resulting from the point charges of strength (Subscript[q, i]) at {(Subscript[a, i]), (Subscript[b, i])}. 
As you can imagine, the formula for the resulting vector field can be complicated as all get-out.  Nevertheless you can explain why this complicated electric field has no sources or sinks other than at the singularities at
       {(Subscript[a, 1]), (Subscript[b, 1])}, {(Subscript[a, 2]), (Subscript[b, 2])}, …, {(Subscript[a, n]), (Subscript[b, n])}.
Give your explanation.

G.5.e.ii) Gauss's law in physics

Gauss's law in physics says that if you take n different points 
       {(Subscript[a, 1]), (Subscript[b, 1])}, {(Subscript[a, 2]), (Subscript[b, 2])}, …, {(Subscript[a, n]), (Subscript[b, n])}
inside a closed curve C and you place electrical charges of strength 
       (Subscript[q, 1]) at {(Subscript[a, 1]), (Subscript[b, 1])},
       (Subscript[q, 2]) at {(Subscript[a, 2]), (Subscript[b, 2])},
       … , and
       (Subscript[q, n]) at {(Subscript[a, n]), (Subscript[b, n])},
then the flux (= flow) of the resulting electric field across C is simply
     2  π ((Subscript[q, 1]) +  (Subscript[q, 2]) +  (Subscript[q, 3]) +  …  +  (Subscript[q, n])).
Explain where Gauss's law comes from.

Look at this:

\(Clear[ElectricField, a, b, k, m, n, q, x, y]; 
    
{m\_k[x_, y_], n\_k[x_, y_]} = 
      \(q\_k\ {x - a\_k, y - b\_k}\)\/\(\((x - a\_k)\)\^2 + 
          \((y - b\_k)\)\^2\); 

    ElectricField\_k[x_, y_] = {m\_k[x, y], n\_k[x, y]}\)

and look at the flow-across measurement  
       (∮_( (Subscript[C, i]))) -n[x, y] dx  +  
        m[x, y] dy
where (Subscript[C, i]) is a small circle centered at {(Subscript[a, i]), (Subscript[b, i])}:

Clear[r, t];
{x[t_], y[t_]} = {(Subscript[a, k]), (Subscript[b, k])} + (Subscript[r, k]) {Cos[t], Sin[t]};
(∫_0^(2 π))(-(Subscript[n, k])[x[t], y[t]] x'[t]+(Subscript[m, k])[x[t], y[t]] y'[t])\[DifferentialD]t

G.6)  The Laplacian (∂^2)f[x, y]/∂(x^2)+ (∂^2)f[x, y]/∂(y^2) and steady-state heat*

Here is a cleared function and its gradient field :

\(Clear[x, y, z, f, gradf, m, n, Field, divField, rotField]; 

    gradf[x_, y_] = {D[f[x, y], x], D[f[x, y], y]}; 
    
{m[x_, y_], n[x_, y_]} = gradf[x, y]; 

    Field[x_, y_] = {m[x, y], n[x, y]}\)

Here is the rotation of this gradient field:

rotField[x_, y_] = D[n[x, y], x] - D[m[x, y], y]

G.6.a.i)

Is it true that all gradient fields are irrotational (have no swirls)?

G.6.a.ii)

Here is the divergence of this gradient field:

divField[x_, y_] = D[m[x, y], x] + D[n[x, y], y]

Folks like to call
       (∂^2)f[x, y]/∂(x^2)+ (∂^2)f[x, y]/∂(y^2)
        = D[f[x, y], {x, 2}] + D[f[x, y], {y, 2}]
        = divField[x, y]
by the name Laplacian of f[x, y].
How do you use the sign of  
       (∂^2)f[x, y]/∂(x^2)+ (∂^2)f[x, y]/∂(y^2)
to determine whether a point {x, y} is a source or a sink of the gradient field of f[x, y]?
How do you check the Laplacian           
       (∂^2)f[x, y]/∂(x^2)+ (∂^2)f[x, y]/∂(y^2)
to learn whether a given gradient field
     Field[x, y] = gradf[x, y] 
is free of sources and sinks at points other than singularities?

G.6.b.i)

Here's a concrete slab:

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

    \(tlow = 0; \)\)thigh = 2 π; zlow = 0; zhigh = 0.5; bottom = 
      ParametricPlot3D[{r x[t], r y[t], 0}, {r, 0, 1}, {t, tlow, thigh}, 
        PlotPoints -> {2, Automatic}, DisplayFunction -> Identity]; 
    top = 
      ParametricPlot3D[{r x[t], r y[t], 0.5}, {r, 0, 1}, {t, tlow, thigh}, 
        PlotPoints -> {2, Automatic}, DisplayFunction -> Identity]; 
    \(side = 
      ParametricPlot3D[{x[t], y[t], z}, {z, zlow, zhigh}, {t, tlow, thigh}, 
        PlotPoints -> {2, Automatic}, DisplayFunction -> Identity]; 
    

Show[top, bottom, side, 
      AxesLabel -> {"x", "y", "z"}, 
      ViewPoint -> CMView, BoxRatios -> Automatic, 
      Boxed -> False, DisplayFunction -> $DisplayFunction]; \)

You heat this slab any way you like, and then you apply perfect insulation to the top and bottom.  At the same time, you apply heating pads to the side to keep the temperature along each vertical segment through points 
       {x[t], y[t], z}(0 < z < 0.5) 
at the same temperature, but your heating pad allows for the temperature to vary as t varies. 
In other words, different vertical line segments on the sides are kept at possibly different temperatures, but the temperature doesn't vary along any one vertical line segment on the side.
You leave for a long time and wait for the temperature inside the slab to settle into its steady state condition.  After you come back, the temperature at a point {x, y, z} inside the slab will not vary as z varies but the temperature at a point {x, y, z} probably will vary as x and y vary. 
Put
       temp[x, y] = steady state temperature at {x, y, z}. 
In the steady state, no point inside the slab and not on the side or the top or the bottom can be a source of new heat flow or a sink for old heat.
Why does this tell you that
       (∂^2)temp[x, y]/∂(x^2)+ (∂^2)temp[x, y]/∂(y^2)=0
at each point {x, y} with {x, y, z} inside but not on the outer surface of the slab?

G.6.b.ii) Hot spots

Assume {(Subscript[x, 0]), (Subscript[y, 0])} is a hot spot inside the slab in the sense that
       temp[(Subscript[x, 0]), (Subscript[y, 0])] > temp[x, y] for nearby {x, y}.
-> Why do you think that the net flow of the gradient field of temp[x, y] across small circles centered at {(Subscript[x, 0]), (Subscript[y, 0])} must be from outside to inside?
-> What does the fact that
       (∂^2)temp[x, y]/∂(x^2)+ (∂^2)temp[x, y]/∂(y^2)=0
tell you the flow of the gradient field of temp[x, y] across these same small circles actually is?
Say how your responses to the last two questions give you an explanation of why no such hot spot can exist.

Remember gradtemp[x, y] points in the direction of greatest instantaneous increase of temp[x, y].

G.6.b.iii) Cold spots

Can there be {(Subscript[x, 0]), (Subscript[y, 0])}, a cold spot, inside the slab in the sense that
       temp[(Subscript[x, 0]), (Subscript[y, 0])] < temp[x, y] for nearby {x, y}?

G.6.b.iv)

How do you know that both the hottest and coldest spots of the slab will be found on the sides?

G.7)  Calculating (∮_( C)) m[x, y] dx  +  
        n[x, y] dy in the presence of singularities

G.7.a)

Here are two curves (Subscript[C, 1]) and (Subscript[C, 2]):

\(Clear[x1, y1, x2, y2, t]; 
tlow = 0; 
\(thigh = 2\ π; \)\){x1[t_], y1[t_]} = 
      2 {Cos[t] - (1/2) Cos[2 t], 0.6 Sin[t] + 0.2 Sin[2 t]}; \({x2[t_], y2[t_]} = {0.2, 0.5} + 
        0.5\ {Cos[t], Sin[t]\ \((1 - 0.7\ Sin[t])\)}; 


    curves = ParametricPlot[{{x1[t], y1[t]}, {x2[t], y2[t]}}, {t, tlow, 
          thigh}, PlotStyle 
          -> {{Red, Thickness[0.01]}, {Red, Thickness[0.01]}}, 
        AxesLabel -> {"x", "y"}, PlotRange -> All, 
        Epilog -> {Text["C1", {\(-1\), 0.7}], 
            Text["C2", {0.5, 0.6}]}]; \)

You can be sure that the flow of a vector field
       Field[x, y] = {m[x, y], n[x, y]} 
across (Subscript[C, 1]) is the same as the flow of Field[x, y] across (Subscript[C, 2]) if there are no singularities between (Subscript[C, 1]) and (Subscript[C, 2]), and 
       divField[x, y] = D[m[x, y], x] +  D[n[x, y], y] = 0 
at all points {x, y} between (Subscript[C, 1]) and (Subscript[C, 2]), because this condition guarantees that no extra fluid comes into the flow and no old fluid goes out of the flow between (Subscript[C, 1]) and (Subscript[C, 2]).  
How is this fact related to the fact that, given functions m[x, y] and n[x, y], you can be sure that  
       (∮_( (Subscript[C, 1]))) m[x, y] dx  +  
        n[x, y] dy
        = 
        (∮_( (Subscript[C, 2]))) m[x, y] dx  +  
          n[x, y] dy
if neither m[x, y] nor n[x, y] has singularities between (Subscript[C, 1]) and (Subscript[C, 2]), and 
       D[n[x, y], x] - D[m[x, y], y] = 0 
at all points {x, y} between (Subscript[C, 1]) and (Subscript[C, 2])?

G.7.b.i)

Here's a curve:

Cplot = 
      Graphics[{Thickness[0.01], Red, 
          Line[{{6, 0}, {2, 2}, {0, 6}, {-2, 2}, {-6, 0}, {-2, 
                -2}, {0, -6}, {2, -2}, {6, 0}}]}]; \(label = Graphics[Text["C", {1.2, 4.3}]]; 


    Show[Cplot, label, Axes -> True, AxesLabel -> {"x", "y"}, 
      AspectRatio -> Automatic]; \)

Go with:

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

Note the singualarity at {0, 0} and look at:

Together[D[n[x, y], x] - D[m[x, y], y]]

Go with the curve C plotted above.
Does the fact that 
       D[n[x, y], x] - D[m[x, y], y] = 0 
tell you that you can calculate
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
by calculating  
       (∮_( (Subscript[C, 1]))) m[x, y] dx  +  
        n[x, y] dy
for a well-chosen substitute closed curve (Subscript[C, 1])?

G.7.b.ii)

Continue to go with the C, the m[x, y], and the n[x, y] as set above.
If you take (Subscript[C, 1]) to be the circle of radius 0.7 centered at {2, 0} like this:

\(Clear[x1, y1, t]; 
{x1[t_], y1[t_]} = {2, 0} + 0.7\ {Cos[t], Sin[t]}; 
    
\(littlecircle = 
      ParametricPlot[{x1[t], y1[t]}, {t, 0, 2\ π}, 
        PlotStyle -> {{Thickness[0.01], Red}}, 
        DisplayFunction -> Identity]; \)\)\(extralabel = Graphics[Text["C1", {2, 1}]]; 


    Show[Cplot, littlecircle, label, extralabel, PlotRange -> All, 
      Axes -> True, AxesLabel -> {"x", "y"}, 
      AspectRatio -> Automatic, 
      DisplayFunction -> $DisplayFunction]; \)

and if you say that  
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
        = 
        (∮_( (Subscript[C, 1]))) m[x, y] dx  +  
          n[x, y] dy,
then you would be wrong.
Why would you be wrong?

G.7.b.iii)

Continue to go with the C, the m[x, y], and the n[x, y] as set above.
Only a dweeb would calculate 
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
by parameterizing C.  Take a good choice of a little circle (Subscript[C, 1]), and calculate
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
correctly by calculating 
       (∮_( (Subscript[C, 1]))) m[x, y] dx  +  
        n[x, y] dy.

G.7.c.i)

Here's a new curve C:

Cplot = 
      Graphics[{Thickness[0.01], Red, 
          Line[{{2 Cos[((0 π)/8)], Sin[((0 π)/8)]}, 
              5 {Cos[(π/8)], Sin[(π/8)]}, {2 Cos[((2 π)/8)], 
                Sin[((2 π)/8)]}, 
              5 {Cos[((3 π)/8)], Sin[((3 π)/8)]}, {
                2 Cos[((4 π)/8)], Sin[((4 π)/8)]}, 
              5 {Cos[((5 π)/8)], Sin[((5 π)/8)]}, {
                2 Cos[((6 π)/8)], Sin[((6 π)/8)]}, 
              5 {Cos[((7 π)/8)], Sin[((7 π)/8)]}, {
                2 Cos[((8 π)/8)], Sin[((8 π)/8)]}, 
              5 {Cos[((9 π)/8)], Sin[((9 π)/8)]}, {
                2 Cos[((10 π)/8)], Sin[((10 π)/8)]}, 
              5 {Cos[((11 π)/8)], Sin[((11 π)/8)]}, {
                2 Cos[((12 π)/8)], Sin[((12 π)/8)]}, 
              5 {Cos[((13 π)/8)], Sin[((13 π)/8)]}, {
                2 Cos[((14 π)/8)], Sin[((14 π)/8)]}, 
              5 {Cos[((15 π)/8)], Sin[((15 π)/8)]}, {
                2 Cos[((16 π)/8)], Sin[((16 π)/8)]}}]}]; label = Graphics[Text["C", {2, 3}]]; Show[Cplot, label, Axes -> True, AxesLabel -> {"x", "y"}, 
      AspectRatio -> Automatic];

This time go with:

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

Check:

Together[D[n[x, y], x] - D[m[x, y], y]]

Go with the curve C plotted above and calculate
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
by integrating over a substitute curve.

You might want to calculate
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
by calculating 
       \(∮\_\(\ C\)\ m\_1[x, y] dx\  + \ 
        n\_1[x, y] dy + 
	\ \ \ 
        ∮\_\(\ C\)\ m\_2[x, y] dx\  + \ 
        n\_2[x, y] dy\)
where:

{(Subscript[m, 1])[x_, y_], (Subscript[n, 1])[x_, y_]} = {-(y/((x^2) + (y^2))), 
        (x/((x^2) + (y^2)))}

and

{(Subscript[m, 2])[x_, y_], (Subscript[n, 2])[x_, y_]} = {
        ((3 (4 + y))/((x^2) + (((4 + y))^2))), 
        -((3 x)/((x^2) + (((4 + y))^2)))}

Check:

{m[x, y], 
        n[x, y]} == {(Subscript[m, 1])[x, y], (Subscript[n, 1])[x, y]} + {(Subscript[m, 2])[x, y], (Subscript[n, 2])[x, y]}

G.7.d ) Path dependence in the presence of singularities

Here are two functions m[x, y] and n[x, y]:

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

Here are four curves all parameterized to start at {-3, 0} and end at {1, 0}:

\(Clear[x1, y1, x2, y2, x3, y3, x4, y4, t]; 
tlow = 0; 

    \(thigh = π; \)\){x1[t_], 
        y1[t_]} = {-1, 0} + {2 Cos[π + t], Sin[t]/2 + (t/π)}; 
    {x2[t_], 
        y2[t_]} = {-1, 0} + {2 Cos[π + t], 
          Sin[t] + (1/5) Sin[5 t] + (t/π)}; {x3[t_], 
        y3[t_]} = {-1, 0} + {2 Cos[π + t], 1.5 Sin[t] + (t/π)}; 
    {x4[t_], 
        y4[t_]} = {-1, 0} + {2 Cos[π + t], -Sin[t] + (t/π)}; 
    curveplots = 
      ParametricPlot[{{x1[t], y1[t]}, {x2[t], y2[t]}, {x3[t], y3[t]}, {x4[t], 
            y4[t]}}, {t, tlow, thigh}, 
        PlotStyle 
          -> {{Thickness[0.01], Red}, {Thickness[0.01], Brown}, {
              Thickness[0.01], Purple}, {Thickness[0.01], Blue}}, 
        Epilog -> {{PointSize[0.03], Point[{-3, 0}]}, {
              PointSize[0.03], Point[{1, 1}]}, 
            Text["start", {-3, -1}, {-2, -1}], 
            Text["end", {1, 1}, {2, -1}]}];

Look at these calculations of 
       (∮_( (Subscript[C, 1]))) m[x, y] dx  +  
        n[x, y] dy,  
       (∮_( (Subscript[C, 2]))) m[x, y] dx  +  
        n[x, y] dy,
       (∮_( (Subscript[C, 3]))) m[x, y] dx  +  
        n[x, y] dy,  and 
       (∮_( (Subscript[C, 4]))) m[x, y] dx  +  
        n[x, y] dy:

C1pathintegral=NIntegrate[m[x1[t], y1[t]] x1'[t]+n[x1[t], y1[t]] y1'[t],{t, tlow, thigh}]

C2pathintegral=NIntegrate[m[x2[t], y2[t]] x2'[t]+n[x2[t], y2[t]] y2'[t],{t, tlow, thigh}]

C3pathintegral=NIntegrate[m[x3[t], y3[t]] x3'[t]+n[x3[t], y3[t]] y3'[t],{t, tlow, thigh}]

C4pathintegral=NIntegrate[m[x4[t], y4[t]] x4'[t]+n[x4[t], y4[t]] y4'[t],{t, tlow, thigh}]

Compare them:

{C1pathintegral, C2pathintegral, C3pathintegral, C4pathintegral}

Was this an accident?
If not, try to explain why
       (∮_( (Subscript[C, 1]))) m[x, y] dx  +  
        n[x, y] dy
        = 
        (∮_( (Subscript[C, 2]))) m[x, y] dx  +  
          n[x, y] dy
        = 
        (∮_( (Subscript[C, 3]))) m[x, y] dx  +  
          n[x, y] dy, 
but there was no reason to expect  
       (∮_( (Subscript[C, 4]))) m[x, y] dx  +  
        n[x, y] dy
to agree with the others.

You might begin your answer by looking at:

Together[D[n[x, y], x] - D[m[x, y], y]]

By the way, the vector field {m[x, y], n[x, y]} shows what can happen when a vector field passes the second part of the gradient test without passing the first part.
In fact, if {m[x, y], n[x, y]} were a genuine gradient field, then all four integrals would have calculated out to the same value.

G.8)  Water and electricity*

G.8.a) Electricity

As you probably know, vector fields 
       Field[x, y] = {m[x, y], n[x, y]} 
have an important interpretation in the realm of electricity. 
In the electrical interpretation, the instantaneous voltage drop as you leave {x, y} in the direction of a unit vector U is given by U . Field[x, y]. 
This quantity can be positive or negative. 
As a result, the integral 
       (∮_( C)) unittan . Field ds = 
        (∮_( C)) m[x, y] dx +  
          n[x, y] dy   
is a measure of acculumated voltage drop in the circuit given by one trip around a closed curve C that does not pass through a singularity.
But the voltage at your starting point on C is the same as the voltage at your ending point (because the ending point is the starting point).
So for this electrical interpretation,  
       (∮_( C)) unittan . Field ds = 
        (∮_( C)) m[x, y] dx +  
            n[x, y] dy = 0 
for any closed curve C not passing through a singularity.
In other words, the net flow of 
       Field[x, y] = {m[x, y], n[x, y]} 
along any closed curve not passing through a singularity must be 0.
Vector fields that are suitable for this electrical interpretation are often called irrotational fields.

G.8.a.i)

If Field[x, y] = {m[x, y], n[x, y]} has no singularities, then what condition on rotField[x, y] signals that Field[x, y] is suitable for the electrical interpretation?

G.8.a.ii)

If Field[x, y] is the gradient field of some function f[x, y], then is there anything to disqualify Field[x, y] from being suitable for the electric interpretation?

G.8.a.iii)

Here is a vector field:

\(Clear[Field1, m1, n1, x, y]; 
    
{m1[x_, y_], n1[x_, y_]} = {y, \(-x\)}\/\(x\^2 + y\^2\); 

    Field1[x_, y_] = {m1[x, y], n1[x, y]}\)

Here is rotField1[x, y]:

rotField1[x, y] = Together[D[n1[x, y], x] - D[m1[x, y], y]]

Look at a plot of this vector field.

scalefactor = 2; \(field1plot = 
      Table[Arrow[Field1[x, y], Tail -> {x, y}, 
          VectorColor -> Blue, \ ScaleFactor -> scalefactor, 
          HeadSize -> 0.4], {x, \(-4.5\), 4.5, 9\/5}, {y, \(-4.5\), 4.5, 
          9\/5}]; 


    Show[field1plot, Axes -> True, AxesLabel -> {"x", "y"}]; \)

In spite of the fact that 
       rotField1[x, y] = 0 
at all points {x, y} other than the singularity at {0, 0}, this vector field cannot be an electric field. Why?

Look at 
       (∮_( C)) m1[x, y] dx  +  
        n1[x, y] dy
where C is the circle of radius 1 centered at {0, 0}.

G.8.a.iv)

Here's another vector field:

\(Clear[Field2, m2, n2, x, y]; 
    
{m2[x_, y_], n2[x_, y_]} = {x, y}\/\(x\^2 + y\^2\); 

    Field2[x_, y_] = {m2[x, y], n2[x, y]}\)

Here is rotField2[x, y]:

rotField2[x, y] = Together[D[n2[x, y], x] - D[m2[x, y], y]]

Look at a plot of this vector field.

scalefactor = 2; \(field1plot = 
      Table[Arrow[Field2[x, y], Tail -> {x, y}, 
          VectorColor -> Blue, \ ScaleFactor -> scalefactor, \ 
          HeadSize -> 0.4], {x, \(-4.5\), 4.5, 9\/5}, {y, \(-4.5\), 4.5, 
          9\/5}]; 

    \(Show[field1plot, Axes -> True, AxesLabel -> {"x", "y"}]; 
    \)\)

In spite of the singularity at {0, 0}, how do you know that this vector field qualifies as a model of electricity?

Because 
       rotField2[x, y] = D[n2[x, y], x] - D[m2[x, y], y] = 0 
except at the singularity at {0, 0}, you know that if C is a closed curve with {0, 0} not inside C, then
       (∮_( C)) m2[x, y] dx  +  
          n2[x, y] dy = 0.
What is the value of 
       (∮_( C)) m2[x, y] dx  +  
        n2[x, y] dy
for a closed curve C with {0, 0} inside C?

G.8.b.i) Water

For an incompressible fluid flow, like water flow, the net flow across any closed curve C without loops must be 0 unless there are sources (spigots) or sinks (drains) inside C.
The upshot: 
If the flow of Field[x, y] is to model sinkless and sourceless water flow, then Field[x, y] must have no singularities and 
       divField[x, y] = 0 at all points {x, y}.
Also for water flow, the net flow of Field[x, y] along any closed curve C has to be 0, because when you go around a closed curve one time, you have the same amount of water at the end of the trip as you had at the beginning. This means that if the flow of Field[x, y] is to model sinkless and sourceless water flow, then 
       divField[x, y] = 0  and rotField[x, y] = 0 
at all points {x, y}.
For these reasons, fluid dynamics professionals agree that any vector field Field[x, y] with no singularities and with
       divField[x, y] = rotField[x, y] = 0 
at all points {x, y} is a model for sinkless and sourceless water flow.
Look at a plot of the vector field 
       Field[x, y] = {0.07  x, -0.14 y}:

Clear[Field, m, n, x, y]; {m[x_, y_], n[x_, y_]} = {0.07 x, -0.14 y}; Field[x_, y_] = {m[x, y], n[x, y]}; \(fieldplot = 
      Table[Arrow[Field[x, y], Tail -> {x, y}, 
          VectorColor -> Blue], {x, 0, 4, 0.5}, {y, 0, 4, 0.5}]; 


    Show[fieldplot, AxesLabel -> {"x", "y"}, Axes -> True, 
      DisplayFunction -> $DisplayFunction]; \)

This looks like water flowing around a corner. 
Check whether this flow can be sourceless and sinkless water flow around a corner by looking at 
       divField[x, y] and rotField[x, y]:

\(Clear[divField, rotField]; 

    divField[x_, y_] = D[m[x, y], x] + D[n[x, y], y]\)

rotField[x_, y_] = D[n[x, y], x] - D[m[x, y], y]

Drats.
Every point {x, y} is a sink for this vector field.
Consequently this vector field is not a model for water flow around a corner without sources and sinks.
Your job is to set a constant k so that
       Field[x, y] = {0.07  x, -k y}
is a model for water flow around a corner.
Once you have your k, plot your vector field as above.

G.8.b.ii)

Look at this vector field:

Clear[Field, m, n, x, y]; {m[x_, y_], n[x_, y_]} = {0.2 Cos[x] Cosh[y], 
        0.4 Sin[x] Sinh[y]}; Field[x_, y_] = {m[x, y], n[x, y]}; \(fieldplot = 
      Table[Arrow[Field[x, y], Tail -> {x, y}, 
          VectorColor -> Blue], {x, \(-\(π\/2\)\), π\/2, 
          π\/8}, {y, 0, 2, 0.5}]; 


    Show[fieldplot, AxesLabel -> {"x", "y"}, Axes -> True, 
      DisplayFunction -> $DisplayFunction]; \)

This looks like water flowing down on the left toward the x-axis, and then flowing up on the right.
Check whether this flow can be a model for sourceless and sinkless water flow down and up by looking at 
       divField[x, y] and rotField[x, y].
If it checks out, do nothing more; otherwise come up with a constant k so that 
       Field[x, y] = {0.2  Cos[x] Cosh[y], k Sin[x] Sinh[y]}
is a model for sourceless and sinkless water flow down and up.
Plot your model as above.

G.8.b.iii) Gradient fields

When you have a vector field 
       Field[x, y] = {m[x, y], n[x, y]} 
with no singularities, and 
       rotField[x, y] = D[n[x, y], x] - D[m[x, y], y] = 0 
at all points {x, y}, then Field[x, y] passes the gradient test. 
The upshot: 
All vector fields without singularities that model sinkless and sourceless water flow must be gradient fields.
But not all gradient fields can model sourceless and sinkless water flow.
Here is a cleared gradient field:

\(Clear[x, y, m, n, f, Field, gradf]; 

    gradf[x_, y_] = {D[f[x, y], x], D[f[x, y], y]}; 
    
{m[x_, y_], n[x_, y_]} = gradf[x, y]; 

    Field[x_, y_] = {m[x, y], n[x, y]}\)

As predicted, rotField[x, y] = 0 at all points {x, y}:

D[n[x, y], x] - D[m[x, y], y]

What condition on 
       D[f[x, y], {x, 2}] + D[f[x, y], {y, 2}] 
       =(∂^2) f[x, y]/∂(x^2)+ (∂^2) f[x, y]/∂(y^2)

D[f[x, y], {x, 2}] + D[f[x, y], {y, 2}]

guarantees that divField[x, y] = 0 at each point {x, y}?

G.8.b.iv)

Run the following cells and use the result of each to determine which of the following functions has a gradient field suitable for modeling sourceless and sinkless water flow:

\(Clear[x, y, f]; 
f[x_, y_] = Sin[x]\ Sinh[y]; 

    D[f[x, y], {x, 2}] + D[f[x, y], {y, 2}]\)

\(Clear[x, y, f]; 
f[x_, y_] = Cos[x]\ Sin[y]; 

    D[f[x, y], {x, 2}] + D[f[x, y], {y, 2}]\)

\(Clear[x, y, f]; 
f[x_, y_] = x\^2 + y\^2; 

    D[f[x, y], {x, 2}] + D[f[x, y], {y, 2}]\)

\(Clear[x, y, f]; 
f[x_, y_] = x\^2 - y\^2; 

    D[f[x, y], {x, 2}] + D[f[x, y], {y, 2}]\)

G.9)  Is parallel flow always irrotational?

G.9.a)

Here is a 2D vector field consisting of equal parallel vectors:

\(Clear[Field1, m1, n1, x, y]; 
    
{m1[x_, y_], n1[x_, y_]} = 0.5\ {\(-1\), 1}; 

    Field1[x_, y_] = {m1[x, y], n1[x, y]}\)

Take a look:

\(field1plot = 
      Table[Arrow[Field1[x, y], Tail -> {x, y}, 
          VectorColor -> Blue], {x, \(-2\), 2, 4\/5}, {y, \(-2\), 2, 
          4\/5}]; 


    Show[field1plot, Axes -> True, AxesLabel -> {"x", "y"}]; \)

A calming, steady flow.
Check its rotation:

D[n1[x, y], x] - D[m1[x, y], y]

Just as the plot suggests, this field has no swirls at all.
Here's another vector field flowing in the same direction.

\(Clear[Field2, m2, n2, x, y]; 
    
{m2[x_, y_], n2[x_, y_]} = 
      0.2\ \((\@\(x\^2 + y\^2\) + 1)\)\ {\(-1\), 1}; 

    Field2[x_, y_] = {m2[x, y], n2[x, y]}\)

Take a look:

\(field2plot = 
      Table[Arrow[Field2[x, y], Tail -> {x, y}, 
          VectorColor -> Blue], {x, \(-2\), 2, 4\/5}, {y, \(-2\), 2, 
          4\/5}]; 


    Show[field2plot, Axes -> True, AxesLabel -> {"x", "y"}]; \)

Another calming, steady parallel flow.
The farther {x, y} is from {0, 0}, the faster the flow of Field2[x, y].  Both Field1[x, y] and Field2[x, y] represent parallel flows. Field1[x, y] represents flow at a steady speed, but the flow represented by Field2[x, y] is of variable speed.  
Is this Field2[x, y] also rotation-free?
If not, plot some sample points at which Field2[x, y] is swirling in the counterclockwise way.

G.9.b.i)

One way to make a non-constant parallel flow in the direction of {-1, 1} that is free of all rotation is to take any nonnegative function g[x] and put:

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

    Field[x_, y_] = {m[x, y], n[x, y]}\)

Check rotField[x, y]:

D[n[x, y], x] - D[m[x, y], y]

Here's what you get when you go with 
       g[x] = Sin[x]^2:

\(Clear[Field, m, n, g, x, y]; 
g[x_] = Sin[x]\^2; 

    \({m[x_, y_], n[x_, y_]} = \(g[x - y]\ \) {\(-1\), 1}; \)\)Field[x_, y_] = {m[x, y], n[x, y]}; \(fieldplot = 
      Table[Arrow[Field[x, y], Tail -> {x, y}, 
          VectorColor -> Blue], {x, \(-2\), 2, 4\/5}, {y, \(-2\), 2, 
          4\/5}]; 


    Show[fieldplot, Axes -> True, AxesLabel -> {"x", "y"}]; 
    \)

This flow is guaranteed to be free of rotation at all points because 
       rotField[x, y] = 0 at all points {x, y}, 
and because there are no singularities.
Here's what you get when you go with 
       g[x] = 0.4  (e^(0.2  x)):

\(Clear[Field, m, n, g, x, y]; 
g[x_] = 0.4\ E\^\(0.2\ x\); 

    \({m[x_, y_], n[x_, y_]} = \(g[x - y]\ \) {\(-1\), 1}; \)\)Field[x_, y_] = {m[x, y], n[x, y]}; \(fieldplot = 
      Table[Arrow[Field[x, y], Tail -> {x, y}, 
          VectorColor -> Blue], {x, \(-2\), 2, 4\/5}, {y, \(-2\), 2, 
          4\/5}]; 


    Show[fieldplot, Axes -> True, AxesLabel -> {"x", "y"}]; 
    \)

This flow is guaranteed to be free of rotation at all points because 
       rotField[x, y] = 0 at all points {x, y}, 
and there are no singularities.
Given a and b with a ≠ 0, your job is to say how to set c in terms of a and b so that when you go with a nonconstant nonnegative function g[x], then the vector field 
       Field[x, y] = {m[x, y], n[x, y]} = g[x +  c y] {a, b}
gives you rotation-free, nonconstant, parallel flow on the direction of {a, b}.
Show off your work with a plot or two.

G.9.b.ii)

Given a and b with a = 0 and b ≠ 0, is it possible to set c in terms of b so that when you go with a nonconstant, nonnegative function g[x], the vector field 
       Field[x, y] = {m[x, y], n[x, y]} 
                             = 
        g[x +  c y] {a, b} 
                             = 
        g[x +  c y] {0, b}
gives you rotation-free, nonconstant, parallel flow on the direction of {a, b}?
Why not?

Saying g[x] is nonconstant tells you that there are points at which g'[x] ≠ 0.

G.9.c)

Given definite numbers a, b, c, and d with {a, b} ≠ {0, 0}, agree or disagree with the following statement and explain why:
No matter what nonconstant function g[x] you go with, when you make a nonconstant, parallel flow in the direction of {a, b} by setting     
       Field[x, y] = {m[x, y], n[x, y]} = g[d x +  c y] {a, b}, 
then either
-> Field[x, y] is not free of sources or sinks,
or
-> Field[x, y] is not rotation free.

G.10) Spin fields

Start with a vector field 
       Field[x, y] = {m[x, y], n[x, y]}
and make what some folks call the spin field 
       spinField[x, y] = {-n[x, y], m[x, y]}.
Here's a vector field:

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

    \(Field[x_, y_] = {m[x, y], n[x, y]}; \)\)spinField[x_, y_] = {-n[x, y], m[x, y]}; \(fieldplot = 
      Table[Arrow[Field[x, y], Tail -> {x, y}, 
          VectorColor -> Blue], {x, \(-3\), 3}, {y, \(-3\), 3}]; 


    Show[fieldplot, Axes -> True]; \)

Here's the same vector field plotted together with its spin field:

\(spinfieldplot = 
      Table[Arrow[spinField[x, y], Tail -> {x, y}, 
          VectorColor -> Red], {x, \(-3\), 3}, {y, \(-3\), 3}]; 


    Show[fieldplot, spinfieldplot, Axes -> True]; \)

Again:

\(Clear[x, y, m, n, Field, spinField]; 
    
{m[x_, y_], n[x_, y_]} = {0.3\ x + 0.2, 0.2\ x\ \((1 - y\/3)\)}; 

    \(Field[x_, y_] = {m[x, y], n[x, y]}; \)\)spinField[x_, y_] = {-n[x, y], m[x, y]}; \(fieldplot = 
      Table[Arrow[Field[x, y], Tail -> {x, y}, 
          VectorColor -> Blue], {x, \(-3\), 3, 1}, {y, \(-3\), 3, 1}]; 

    
Show[fieldplot, Axes -> True]; \)

Here's the same vector field plotted together with its spin field:

\(spinfieldplot = 
      Table[Arrow[spinField[x, y], Tail -> {x, y}, 
          VectorColor -> Red], {x, \(-3\), 3, 1}, {y, \(-3\), 3, 1}]; 

    
Show[fieldplot, spinfieldplot, Axes -> True]; \)

Run some more of these to get a feeling for the relationship between a vector field and its spin field.

G.10.a)

Try to describe the geometric relationship between a vector field and its spin field.

Think rotation.

G.10.b)

Here's a cleared vector field and its spin field:

\(Clear[x, y, m, mm, n, nn, Field, spinField]; 

    Field[x_, y_] = {m[x, y], n[x, y]}; 

    \({mm[x_, y_], nn[x_, y_]} = {\(-n[x, y]\), m[x, y]}; \)\)spinField[x_, y_] = {mm[x, y], nn[x, y]}; {Field[x, y], spinField[x, y]}

Here is divField[x, y]:

\(Clear[divField]; 
divField[x_, y_] = D[m[x, y], x] + D[n[x, y], y]\)

Here is rotSpinField[x, y]:

\(Clear[rotSpinField]; 

    rotSpinField[x_, y_] = D[nn[x, y], x] - D[mm[x, y], y]\)

Here is rotField[x, y]:

\(Clear[rotField]; 
rotField[x_, y_] = D[n[x, y], x] - D[m[x, y], y]\)

Here is divSpinField[x, y]:

\(Clear[divSpinField]; 

    divSpinField[x_, y_] = D[mm[x, y], x] + D[nn[x, y], y]\)

Here they are together:

{{divField[x, y], rotSpinField[x, y]}, {rotField[x, y], 
        divSpinField[x, y]}}

Examine what you see above, and then answer the questions below:

-> If {x, y} is a source of spinField[x, y], then which way (clockwise or counterclockwise) is Field[x, y] swirling at {x, y}?
-> If {x, y} is a sink of spinField[x, y], then which way (clockwise or counterclockwise) is Field[x, y] swirling at {x, y}?
-> If {x, y} is a source of (Field[x, y]), then which way (clockwise or counterclockwise) is spinField[x, y] swirling at {x, y}?
-> If {x, y} is a sink of Field[x, y], then which way (clockwise or counterclockwise) is spinField[x, y] swirling at {x, y}
-> If Field[x, y] is a gradient field, then how do you know that spinField[x, y] has no sources or sinks?
-> If spinField[x, y] is a gradient field, then how do you know that Field[x, y] has no sources or sinks?

G.10.c.i)

Here's a cleared vector field and its spin field:

\(Clear[x, y, m, mm, n, nn, Field, spinField]; 

    Field[x_, y_] = {m[x, y], n[x, y]}; 

    \({mm[x_, y_], nn[x_, y_]} = {\(-n[x, y]\), m[x, y]}; \)\)\(spinField[x_, y_] = {mm[x, y], nn[x, y]}; 

    
{Field[x, y], spinField[x, y]}\)

Here is divField[x, y]:

\(Clear[divField]; 
divField[x_, y_] = D[m[x, y], x] + D[n[x, y], y]\)

Here is rotSpinField[x, y]:

\(Clear[rotSpinField]; 

    rotSpinField[x_, y_] = D[nn[x, y], x] - D[mm[x, y], y]\)

Suppose you know that 
       Field[x, y] = gradf[x, y] 
for a function f[x, y], and 
       spinField[x, y] = gradg[x, y] 
for another function g[x, y]. 
Also suppose you know that neither Field[x, y] nor spinField[x, y] has any singularities.
Why is it totally impossible to have a point {(Subscript[x, 0]), (Subscript[y, 0])} such that 
       f[(Subscript[x, 0]), (Subscript[y, 0])] > f[x, y] for {x, y} ≠ {(Subscript[x, 0]), (Subscript[y, 0])}?

First explain why the fact that spinField[x, y] is a gradient field guarantees that  
       divField[x, y] = 0 at all points {x, y},
so that the netflow of Field[x, y] across any given closed curve must be 0.
Then rule out the possibility of finding a point {(Subscript[x, 0]), (Subscript[y, 0])} such that 
       f[(Subscript[x, 0]), (Subscript[y, 0])] > f[x, y] for {x, y} ≠ {(Subscript[x, 0]), (Subscript[y, 0])}
by centering a small circle C at {(Subscript[x, 0]), (Subscript[y, 0])}, and asking yourself what the net flow of the gradf[x, y] across C must be. 
Remember gradf[x, y] points in the direction of greatest initial increase at {x, y}.

G.10.c.ii)

Suppose you know that 
       Field[x, y] = gradf[x, y] 
for a function f[x, y] and 
       spinField[x, y] = gradg[x, y] 
for another function g[x, y].
Try to explain why it must be that
       (∂^2)f[x, y]/∂(x^2)+ (∂^2)f[x, y]/∂(y^2)=0
and
       (∂^2)g[x, y]/∂(x^2)+ (∂^2)g[x, y]/∂(y^2)=0
at all points {x, y} other than singularities.

\(Clear[x, y, m, mm, n, nn, f, g, gradf, gradg, Field, spinField]; 

    Field[x_, y_] = {D[f[x, y], x], D[f[x, y], y]}; 
    
{m[x_, y_], n[x_, y_]} = Field[x, y]\)

\(spinField[x_, y_] = {D[g[x, y], x], D[g[x, y], y]}; 
    
{mm[x_, y_], nn[x_, y_]} = spinField[x, y]\)

Saying that spinField[x, y] is a gradient field tells you that
       rotSpinField[x, y] = 0 
at all points {x, y} other than singularities.  If you did the part above, you'll be able to explain why this means that divField[x, y] = 0 at all points {x, y} other than singularities:
Now check out divField[x, y] = D[m[x, y], x] +  D[n[x, y], y]:

D[m[x, y], x] + D[n[x, y], y]

Now you take over.