VC.06 Sources,  Sinks,  Swirls and Singularities
TUTORIALS

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

T.1)  The pleasure of calculating path integrals 
       (∮_( C)) m[x, y] dx +  
        n[x, y] dy 
when
        D[n[x, y], x] - D[m[x, y], y] = 0

T.1.a.i) No singularity inside C

Here is a curve:

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


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

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

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

    m[x_, y_] = 
      x\^2 + \(2\ \((x - 6)\)\)\/\(\((x - 6)\)\^2 + \((y - 1)\)\^4\)\)

n[x_, y_] = 
      (y^2) + ((4 (((y - 1))^3))/((((x - 6))^2) + (((y - 1))^4)))

Note the singularity at {6, 1} and plot it:

singularity = {6, 1}; \(singularityplot = Graphics[{PointSize[0.03], Point[singularity]}]; 


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

Good.
The singularity is not inside the region enclosed by C.
Now check D[n[x, y], x] - D[m[x, y], y]:

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

Good.
Now, without further calculation, you can be sure that       
       (∮_( C ))m[x, y] dx  +  
          n[x, y] dy = 0.
Why can you be sure of this?

Go with the m[x,y] and n[x,y] used above.
       (∮_( C ))m[x, y] dx  +  
        n[x, y] dy
measures the net flow of the vector field
       Field[x, y] = {n[x, y], -m[x, y]}
across C.

Stop here and read again. 
The vector field you are working with here is  
Field[x, y] = {n[x, y], -m[x, y]}.
The divergence of THIS vector field is
 D[n[x, y], x] - D[m[x, y], y].

This vector field has no singularities inside C, and because
       divField[x, y] = D[n[x, y], x] - D[m[x, y], y] = 0,
this vector field has no sources or sinks within C.  And because you can't get something out of nothing, the net flow of this vector field across C is 0.
So
       (∮_( C ))m[x, y] dx  +  
          n[x, y] dy = 0.
If this stings your brain, you could use the Gauss-Green formula to explain this.
The Gauss-Green formula says that if C is the boundary curve of a region R, then you are guaranteed that 
       (∮_( C ))m[x, y] dx  +  
        n[x, y] dy
        = 
        (∫_^)(∫_( R)^) 
            (D[n[x, y], x] - D[m[x, y], y]) dx 
              dy
        = 
        (∫_^)(∫_( R)^) 
              0 dx dy = 0.

T.1.a.ii) A singularity inside C

Here's the same curve:

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


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

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

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

    m[x_, y_] = \(1 - y\)\/\(\((x + 2)\)\^2 + \((y - 1)\)\^2\)\)

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

Note the singularity at {-2, 1} and plot it:

singularity = {-2, 1}; \(singularityplot = Graphics[{PointSize[0.03], Point[singularity]}]; 


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

This time the singularity is inside the region enclosed by C.
Now check D[n[x, y], x] - D[m[x, y], y]:

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

If there were no singularities inside C, then this information would be enough to tell you that         (∮_( C ))m[x, y] dx  +  
          n[x, y] dy = 0, but this does not tell you that
       (∮_( C ))m[x, y] dx  +  
          n[x, y] dy = 0
because of the nasty singularity (blow up) inside the curve C. 
Encapsulate the singularity by centering a little circle (Subscript[C, 1]) at the singularity, taking care that the circle lies completely within C.  
Here's one:

\(Clear[x1, y1, t]; 
    
{x1[t_], y1[t_]} = singularity + 0.5\ {Cos[t], Sin[t]}; 

    \(C1plot = 
      ParametricPlot[{x1[t], y1[t]}, {t, 0, 2\ π}, 
        PlotStyle -> {{Thickness[0.01], Red}}, 
        DisplayFunction -> Identity]; \)\)singularityplot = Graphics[{PointSize[0.03], Point[singularity]}]; 
    \(extralabel = Graphics[Text["C1", {\(-1.2\), 1}]]; 


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

Now you can be sure that
       (∮_( C ))m[x, y] dx  +  
        n[x, y] dy  
        = 
        (∮_( (Subscript[C, 1]) ))m[x, y] dx  +  
          n[x, y] dy
which is given by:

NIntegrate[m[x1[t], y1[t]] x1'[t]+n[x1[t], y1[t]] y1'[t],{t, 0, 2 π}]

Explain why you can be sure that this calculation is correct.

Go with the m[x, y] and n[x, y] used above.
       (∮_( C ))m[x, y] dx  +  
        n[x, y] dy
measures the net flow of the vector field
       Field[x, y] = {n[x, y], -m[x, y]}
across C.  This vector field has no singularities between C and (Subscript[C, 1]), and because
       divField[x, y] = D[n[x, y], x] - D[m[x, y], y] = 0,
this vector field has no sources or sinks between C and (Subscript[C, 1]).  And because you can't get something out of nothing, the net flow of this vector field across C is the same as the net flow of this vector field across (Subscript[C, 1]).
So
       (∮_( C ))m[x, y] dx  +  
        n[x, y] dy  
        = 
        (∮_( (Subscript[C, 1]) ))m[x, y] dx  +  
          n[x, y] dy.
You've got a hard time using the Gauss-Green formula to explain this directly, because the Gauss-Green formula can fail when C encloses a singularity.

T.1.a.iii) Two singularities inside C

Here is the same curve again:

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


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

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

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

    m[x_, y_] = 
      \(3\ \((1 - y)\)\)\/\(\((x + 2)\)\^2 + \((y - 1)\)\^2\) + 
        \(y + 1\)\/\(\((x + 2)\)\^2 + \((y + 1)\)\^2\)\)

n[x_, y_] = 
      ((3 (x + 2))/((((x + 2))^2) + (((y - 1))^2))) - 
        ((x + 2)/((((x + 2))^2) + (((y + 1))^2)))

Note the singularities at {-2, 1} and {-2, -1} and plot them:

singularity1 = {-2, 1}; singularity2 = {-2, -1}; \(singularityplot = {Graphics[{PointSize[0.03], Point[singularity1]}], 
        Graphics[{PointSize[0.03], Point[singularity2]}]}; 


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

The singularities are inside the region enclosed by C.
Now check D[n[x, y], x] - D[m[x, y], y]:

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

If there were no singularities inside C, then this information would be enough to tell you that (∮_( C ))m[x, y] dx  +  
        n[x, y] dy is 0 . But this does not tell you that
       (∮_( C ))m[x, y] dx  +  
          n[x, y] dy = 0
because of the nasty singularities inside the curve C. 
Encapsulate the singularities by centering a little circle (Subscript[C, 1]) at one singularity and centering another little circle (Subscript[C, 2]) at the other singularity, taking care that both little circles lie completely within C, and that (Subscript[C, 1]) and (Subscript[C, 2]) don't touch or invade each other's territory.   
Here are two suitable circles:

\(Clear[x1, y1, x2, y2, t]; 
    
{x1[t_], y1[t_]} = singularity1 + 0.5\ {Cos[t], Sin[t]}; 

    \({x2[t_], y2[t_]} = singularity2 + 0.5\ {Cos[t], Sin[t]}; \)\)littles = 
      ParametricPlot[{{x1[t], y1[t]}, {x2[t], y2[t]}}, {t, 0, 2 π}, 
        PlotStyle -> {{Thickness[0.01], Red}}, 
        DisplayFunction -> Identity]; singularityplot = {Graphics[{PointSize[0.03], Point[singularity1]}], 
        Graphics[{PointSize[0.03], Point[singularity2]}]}; \(extralabels = {Graphics[Text["C1", {\(-1.2\), 1}]], 
        Graphics[Text["C2", {\(-1.2\), \(-1\)}]]}; 


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

Now you can be sure that
       (∮_( C ))m[x, y] dx  +  
        n[x, y] dy
        = 
        (∮_( (Subscript[C, 1]) ))m[x, y] dx  +  
          n[x, y] dy  +  
          (∮_( (Subscript[C, 2]) ))m[x, y] dx  +  
          n[x, y] dy,
which is given by:

NIntegrate[m[x1[t], y1[t]] x1'[t]+n[x1[t], y1[t]] y1'[t],{t, 0, 2 π}]+NIntegrate[m[x2[t], y2[t]] x2'[t]+n[x2[t], y2[t]] y2'[t],{t, 0, 2 π}]

Explain why you can be sure that this calculation is correct.

Go with the m[x, y] and n[x, y] used above.
       (∮_( C ))m[x, y] dx  +  
        n[x, y] dy
measures the net flow of the vector field
       Field[x, y] = {n[x, y], -m[x, y]}
across C.  This vector field has no singularities between C and the little circles, and because
       divField[x, y] = D[n[x, y], x] - D[m[x, y], y] = 0,
this vector field has no sources or sinks between C and the little circles. And because you can't get something out of nothing, the net flow of this vector field across C is the same as the net flow of this vector field across one little circle added to the net flow of this vector field across the other little circle.
So
       (∮_( C ))m[x, y] dx  +  
        n[x, y] dy
        = 
        (∮_( (Subscript[C, 1]) ))m[x, y] dx  +  
          n[x, y] dy  +  
          (∮_( (Subscript[C, 2]) ))m[x, y] dx  +  
          n[x, y] dy.

T.1.b) Path integrals

Here are two new curves both correctly parameterized in the counterclockwise way:

\(Clear[x1, y1, x2, y2, t]; 
tlow = 0; 
\(thigh = 2\ π; \)\){x1[t_], y1[t_]} = 2 {Cos[t], 0.6 Sin[t] + 0.2 Sin[2 t]}; \({x2[t_], y2[t_]} = {1, 0} + 0.5\ {Cos[t], 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", {\(-0.6\), 0.75}], 
            Text["C2", {1.2, 0.35}]}]; \)

Given functions m[x, y] and n[x, y], what do you check to 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
without going to all the bother of making the individual calculations?

If no singularities of {m[x, y], n[x, y]} pop up between (Subscript[C, 1]) and (Subscript[C, 2]), and if
       D[n[x, y], x] - D[m[x, y], y] = 0 
at all points between (Subscript[C, 1]) and (Subscript[C, 2]), 
then 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.

T.2)  Using a 2D integral to measure flow along closed curves

T.2.a)

Explain this:
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 all 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]dxdy.

Back in the lesson on 2D integrals, you met up with the Gauss-Green formula. The Gauss-Green formula says that if C is the boundary curve of a region R, then you are guaranteed that 
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
        = 
        (∫_^)(∫_( R)) 
              D[n[x, y], x] -  
          D[m[x, y], y] dx dy.
Go with Field[x, y] = {m[x, y], n[x, y]} and put 
       rotField[x, y] = D[n[x, y], x] - D[m[x, y], y],
and read off  
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
       =(∫_^)(∫_( R)) rotField[x, y]dxdy.
Because  
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
measures the flow of Field[x, y] = {m[x, y], n[x, y]} along C, you are guaranteed that   
       =(∫_^)(∫_( R)) rotField[x, y]dxdy
makes the same measurement.

T.2.b)

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

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

Use a 2D integral to measure the net flow of the vector field 
     Field[x, y] = {x +  (y^2), x -  (y^2)} 
along the boundary curve C of this rectangle.

Enter the field:

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

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

Calculate rotField[x, y]:

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

Take another look at R:

Show[Rplot];

Calculate (∫_^)(∫_( R)) rotField[x, y]dxdy:

(∫_(-1)^1)
        (∫_(-2)^2) rotField[x, y] \[DifferentialD]x 
          \[DifferentialD]y

Positive. 
This tells you that the net flow of this vector field along the boundary of this rectangle is counterclockwise.

T.2.c.i)

Take a look at rotField[x, y] for the vector field
       Field[x, y] = {Sin[x] +  y, Cos[y] -  x}

\(Clear[x, y, m, n, Field, rotField]; 
    
{m[x_, y_], n[x_, y_]} = {Sin[x] + y, Cos[y] - x}; 

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

You look at this and note that 
       rotField[x, y] < 0 
no matter what {x, y} is. And then you say:
"Good, this tells me that the flow of this vector field along any closed curve is clockwise." 
You are right.
Why are you right?

Take any closed curve C and call R the region C encloses.  You can calculate the flow  
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
of Field[x, y] = {m[x, y], n[x, y]} along C by calculating the 2D integral
       (∫_^)(∫_( R)) rotField[x, y]dxdy .
Because 
       rotField[x, y] < 0 
no matter what {x, y} you go with, you are guaranteed that
       (∫_^)(∫_( R)) rotField[x, y]dxdy<0.
So
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
       =(∫_^)(∫_( R)) rotField[x, y]dxdy<0
no matter what closed curve C you go with.
This tells you that the flow of this vector field along any closed curve is clockwise.

T.2.c.ii)

Take a look at rotField[x, y] for the vector field
       Field[x, y] = {Sin[x] -  (y^5), Cos[y] +  (x^3)}

\(Clear[x, y, m, n, Field, rotField]; 
    
{m[x_, y_], n[x_, y_]} = {Sin[x] - y\^5, Cos[y] + x\^3}; 

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


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

You look at this and note that 
       rotField[x, y] > 0 
unless {x, y} = {0, 0}. And then you say:
"Good, this tells me that the net flow of this vector field along any closed curve is counterclockwise." 
You are right.
Why are you right?

Take any closed curve C, and call R the region C encloses.  You can calculate the flow  
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
of Field[x, y] = {m[x, y], n[x, y]} along C by calculating the 2D integral
       (∫_^)(∫_( R)) rotField[x, y]dxdy.
Because 
       rotField[x, y] > 0 
except at one point, you are guaranteed that
       (∫_^)(∫_( R)) rotField[x, y]dxdy>0.
So
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
       =(∫_^)(∫_( R)) rotField[x, y]dxdy>0
no matter what closed curve C you go with.
This tells you that the net flow of this vector field along any closed curve is counterclockwise.

T.3)  Rotation (swirl) of a vector field

T.3.a)  Fingering a vector field to get the meaning of the sign of 
       rotField[x, y] = D[n[x, y], x] - D[m[x, y], y]

Given a vector field Field[x, y] = {m[x, y], n[x, y]}, lick the tip of your index finger and touch it to a point {(Subscript[x, 0]), (Subscript[y, 0])} while the vector field is in full flow. What does the sign of 
       rotField[(Subscript[x, 0]), (Subscript[y, 0])] 
tell you about the about the swirl your finger feels?
Illustrate with a plot.

If rotField[(Subscript[x, 0]), (Subscript[y, 0])] > 0, then you feel Field[x, y] swirling around {(Subscript[x, 0]), (Subscript[y, 0])} in the counterclockwise way. 
If rotField[(Subscript[x, 0]), (Subscript[y, 0])] < 0, then you fell Field[x, y] swirling around {(Subscript[x, 0]), (Subscript[y, 0])} in the clockwise way.
Here's why: 
Take a small circle C centered at {(Subscript[x, 0]), (Subscript[y, 0])}.  Calculate the flow of Field[x, y] along C by calculating 
       (∮_( C)) m[x, y] dx  +  
          n[x, y] dy=(∫_^)(∫_( R)) rotField[x, y]dxdy.
Here's the kicker:  
If 
       rotField[(Subscript[x, 0]), (Subscript[y, 0])] > 0, 
then it is positive for all {x, y}'s close to {(Subscript[x, 0]), (Subscript[y, 0])}, so if C is so small that
       rotField[(Subscript[x, 0]), (Subscript[y, 0])] > 0 
at all {x, y}'s inside C, then you see that
       (∮_( C)) m[x, y] dx  +  
          n[x, y] dy=(∫_^)(∫_( R)) rotField[x, y]dxdy>0.
The upshot: 
If rotField[(Subscript[x, 0]), (Subscript[y, 0])] > 0, then the net flow of Field[x, y] along small circles centered at {(Subscript[x, 0]), (Subscript[y, 0])} is counterclockwise.
Similarly, if rotField[(Subscript[x, 0]), (Subscript[y, 0])] < 0, then the net flow of Field[x, y] along small circles centered at {(Subscript[x, 0]), (Subscript[y, 0])} is clockwise.  
Check this out for the following vector field at {0, 0}:

\(Clear[x, y, m, n, Field, rotField]; 
m[x_, y_] = x + 3\ y\^2; 

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


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

Look at:

rotField[0, 0]

Positive. 
This means Field[x, y] swirls around {0, 0} in the counterclockwise way. Take a look at what the vector field is doing near {0, 0}:

fingerpoint = {0, 0}; h = 0.5; \(scalefactor = 0.1; 

    fieldplot = 
      Table[Arrow[Field@@\((fingerpoint + {x, y})\), 
          Tail -> fingerpoint + {x, y}, 
          ScaleFactor -> scalefactor], {x, \(-h\), h, h\/3}, {y, \(-h\), 
          h, h\/3}]; 

    fingerpointplot = Graphics[{PointSize[0.07], Point[fingerpoint]}]; 


    Show[fingerpointplot, fieldplot, Axes -> Automatic, 
      AspectRatio -> Automatic, PlotRange -> All, 
      AxesLabel -> {"x", "y"}]; \)

Lick the tip of your index finger, put the tip of your finger at the point, and feel the counterclockwise swirl.

T.3.b) Clockwise versus counterclockwise

Here's a vector field:

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


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

Give a sample plot of some of the points {x, y} about which this vector field swirls in the counterclockwise way.

Here's rotField[x, y]:

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

The vector field swirls around {x, y} in the counterclockwise way if rotField[x, y] > 0.  Here comes the plot:

Show[
      Table[If[N[rotField[x, y]] > 0, 
          Graphics[{PointSize[0.02], Red, Point[{x, y}]}], 
          Graphics[{PointSize[0.01], Blue, Point[{x, y}]}]], {x, -5, 5, 
          0.25}, {y, -4, 4, 0.25}], Axes -> True, 
      AxesLabel -> {"x", "y"}];

T.3.c) Rotation (swirl) at a point

Why do most folks call rotField[x, y] the rotation of a vector field Field[x, y]?

The name fits.  
If rotField[x, y] > 0, then the fluid swirls around {x, y} in the counterclockwise way.
If rotField[x, y] < 0, then the fluid swirls around {x, y} in the clockwise way.
If rotField[x, y] = 0, then the fluid has no swirl at all as it passes by {x, y}.

T.4)  Summary of main ideas.

T.4.a.i) Sources versus sinks

If 
       Field[x, y] = {m[x, y], n[x, y]}
is a vector field, then a point {x, y} is:
-> a source of new fluid if
       divField[x, y] = D[m[x, y], x] +  D[n[x, y], y] > 0
-> a sink for old fluid if
       divField[x, y] = D[m[x, y], x] +  D[n[x, y], y] < 0
-> neither a source nor a sink if
       divField[x, y] = D[m[x, y], x] +  D[n[x, y], y] = 0.

T.4.a.ii) Counterclockwise versus clockwise swirl

If 
       Field[x, y] = {m[x, y], n[x, y]}
is a vector field, then a the swirl about a point {x, y} is:
-> counterclockwise provided
       rotField[x, y] = D[n[x, y], x] -  D[m[x, y], y] > 0
-> clockwise provided
       rotField[x, y] = D[n[x, y], x] -  D[m[x, y], y] < 0.

T.4.b.i) Flow across

If C is a closed curve and R is the region inside C, then the net flow of a vector field 
     Field[x, y] = {m[x, y], n[x, y]} 
across C is measured by           
       (∮_( C)) -n[x, y] dx  +  
          m[x, y] dy = 
        (∫_^)(∫_( R)) 
            divField[x, y] dx dy
provided there are no singularities inside C.
(Here divField[x, y] = D[m[x, y], x] +  D[n[x, y], y].)
If divField[x, y] = 0 at all points inside C, and there are no singularities inside C, then the net flow of Field[x, y] across C is 0.
If divField[x, y] > 0 at all points inside C, and there are no singularities inside C, then the net flow of Field[x, y] across C is from inside to outside.
If divField[x, y] < 0 at all points inside C, and there are no singularities inside C, then the net flow of Field[x, y] across C is from outside to inside.

T.4.b.ii) Flow along

If C is a closed curve and R is the region inside C, then the net flow of a vector field 
       Field[x, y] = {m[x, y], n[x, y]} 
along C is measured by           
       (∮_( C)) m[x, y] dx  +  
          n[x, y] dy=(∫_^)(∫_( R)) rotField[x, y]dxdy
provided there are no singularities inside C.
(Here rotField[x, y] = D[n[x, y], x] -  D[m[x, y], y].)
If rotField[x, y] = 0 at all points inside C, and there are no singularities inside C, then the net flow of Field[x, y] along C is 0.
If rotField[x, y] > 0 at all points inside C, and there are no singularities inside C, then the net flow of Field[x, y] along C is counterclockwise.
If divField[x, y] < 0 at all points inside C, and there are no singularities inside C, then the net flow of Field[x, y] along C is clockwise.

T.4.c.i) Singularities and flow-across measurements

Given a vector field Field[x, y] = {m[x, y], n[x, y]},
if (Subscript[C, 1]) and (Subscript[C, 2]) are two closed curves with (Subscript[C, 1]) running inside (Subscript[C, 2])((Subscript[C, 1]) is allowed to touch (Subscript[C, 2])) and if 
-> there are no singularities of Field[x, y] 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]), 
then 
       (∮_( (Subscript[C, 1]))) -n[x, y] dx  +  
        m[x, y] dy
           = 
        (∮_( (Subscript[C, 2]))) -n[x, y] dx  +  
          m[x, y] dy,
so that the net flow of Field[x, y] across (Subscript[C, 1]) equals the net flow of Field[x, y] across (Subscript[C, 2]).

T.4.c.ii) Singularities and path integrals

Given functions m[x, y] and n[x, y], if 
-> (Subscript[C, 1]) and (Subscript[C, 2]) are two closed curves with (Subscript[C, 1]) running inside (Subscript[C, 2])((Subscript[C, 1]) is allowed to touch (Subscript[C, 2])), and if 
-> neither m[x, y] nor n[x, y] has a singularity anywhere between (Subscript[C, 1]) and (Subscript[C, 2]), and if
-> D[n[x, y], x] -  D[m[x, y], y] = 0, 
then 
       (∮_( (Subscript[C, 1]))) m[x, y] dx  + 
        n[x, y] dy
           = 
        (∮_( (Subscript[C, 2]))) m[x, y] dx  +  
          n[x, y] dy.