VC.05 Flow Measurements by Integrals
 LITERACY

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

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

CMView = {2.7, 1.6, 1.2};

Vector Drawer

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

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

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

End[]; 

    \(EndPackage[]; \)\)

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

Spherical Setup

\(Clear[polar]; 

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

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

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

    Clear[xyplane]; 

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

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

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

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

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

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

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

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

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

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

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

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

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

    Clear[xyarc2]; 

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

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

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

Crisscross

\(Clear[x]; 

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

L.1)

You have a given vector field 
       Field[x, y] = {m[x, y], n[x, y]}.
You have parameterized the ellipse 
       ((((x/2)))^2)+((((y/3)))^2)=1  
in the counterclockwise way with 
       {x[t], y[t]} = {2  Cos[t], 3  Sin[t]}  
with 0 ≤ t ≤ 2  π.
You calculate
       (∮_( C)) m[x, y] dx  +  
        n[x, y] dy
       =(∫_0^(2  π))(m[x[t], y[t]] x'[t]+ n[x[t], y[t]] y'[t])dt,
and learn that 
       (∮_( C)) m[x, y] dx  +  
          n[x, y] dy = 9.01.
Then you calculate
       (∮_( C)) -n[x, y] dx  +  
        m[x, y] dy 
       =(∫_0^(2  π))(-n[x[t], y[t]] x'[t]+ m[x[t], y[t]] y'[t])dt,
and learn that 
       (∮_( C)) -n[x, y] dx  +  
          m[x, y] dy = -3.52.
Is the net flow of Field[x, y] along C clockwise or counterclockwise?
Is the net flow of Field[x, y] across C from outside to inside, or is it from inside to outside?

L.2)

You are walking around a closed curve C with no loops (a curve like a distorted circle) in the counterclockwise way, and at time t, you are at the point {x[t], y[t]}.
The unit tangent vector 
       unittan[t]=(({x'[t] , y'[t]})/(Sqrt[((x'[t])^( 2)) +  ((y'[t])^( 2
                  ))]))
with tail at {x[t], y[t]} points out away from your belly in the direction you are walking.
When you use this unit tangent to measure the flow of a vector field
       Field[x, y] = {m[x, y], n[x, y]} 
along C, you calculate
       (∮_( C)) m[x, y] dx  +  
          n[x, y] dy = 
        (∮_( C)) F . unittan ds. 
How do you interpret the result if it turns out that 
       (∮_( C)) m[x, y] dx  +  
          n[x, y] dy > 0?
How do you interpret the result if it turns out that  
       (∮_( C)) m[x, y] dx  +  
          n[x, y] dy < 0?
How do you interpret the result if it turns out that  
       (∮_( C)) m[x, y] dx  +  
          n[x, y] dy = 0?

L.3)

You are walking around a closed curve C with no loops (a curve like a distorted circle) in the counterclockwise way, and at time t, you are at the point {x[t], y[t]}.
The unit normal vector 
       outerunitnormal[t]=(({y'[t] , -x'[t]})/(Sqrt[((x'[t])^( 2)) +  ((y'[t])^( 2
                  ))]))
with tail at {x[t], y[t]} points out away from the curve toward your right foot.
When you use this unit normal to measure the flow of a vector field     
       Field[x, y] = {m[x, y], n[x, y]} 
across C, you calculate
       (∮_( C)) -n[x, y] dx  +  
          m[x, y] dy = 
        (∮_( C)) 
          F . outerunitnormal ds. 
How do you interpret the result if 
       (∮_( C)) -n[x, y] dx  +  
          m[x, y] dy > 0?
How do you interpret the result if 
       (∮_( C)) -n[x, y] dx  +  
          m[x, y] dy < 0?
How do you interpret the result if 
       (∮_( C)) -n[x, y] dx  +  
          m[x, y] dy = 0?

L.4)

Measure by hand calculation the net flow across the circle 
       (x^2) +  (y^2) = 4
of a fluid whose velocity is given by the vector field  
       Field[x, y] = {x, y}.
Don't forget that Sin[t]^( 2) +  Cos[t]^( 2) = 1.
Is the net flow of F[x, y] across this curve from inside to outside or outside to inside?

L.5)

Measure by hand calculation the net flow along the circle 
       (x^2) +  (y^2) = 9
of a fluid whose velocity is given by the vector field  
       Field[x, y] = {-y, x}.
Don't forget that Sin[t]^( 2) +  Cos[t]^( 2) = 1.
Is the net flow of F[x, y] along this curve clockwise or counterclockwise?

L.6)

When you go with a given vector field
       Field[x, y] = {m[x, y], n[x, y]} 
and a closed curve C (like a deformed circle), you measure the flow of this vector field across C by calculating the path integral
       (∮_( C)) -n[x, y] dx  +  
        m[x, y] dy. 
To calculate  (∮_( C)) -n[x, y] dx  +  
        m[x, y] dy, you go with two functions x[t] and y[t] and two numbers, tlow and thigh.
And then you calculate
       (∮_( C)) -n[x, y] dx  +  
        m[x, y] dy
       =(∫_tlow^thigh) (-n[x[t], y[t]]x'[t] + m[x[t], y[t]]y'[t])dt.
What conditions must the two functions, x[t] and y[t], and the two numbers, tlow and thigh, satisfy for you to be sure that your calculation is correct?

L.7)

Suppose (Subscript[C, 1]) and (Subscript[C, 2]) are physically the same curve, but they are parameterized so that the starting point of (Subscript[C, 1]) is the ending point of (Subscript[C, 2]), and the ending point of (Subscript[C, 1]) is the starting point of (Subscript[C, 2]).
Express
       (∫_( (Subscript[C, 1]))) m[x, y] dx  +  
        n[x, y] dy 
in terms of
       (∫_( (Subscript[C, 2]))) m[x, y] dx  +  
        n[x, y] dy.

L.8)

Take a given vector field 
       Field[x, y] = {m[x, y], n[x, y]}.
If (Subscript[C, 1]) and (Subscript[C, 2]) are two curves that are parameterized to start at a given point {a, b}, and end at another given point {c, d}, but are not the same physical curve, what do you look for to determine whether you guaranteed that
       (∫_( (Subscript[C, 1]))) m[x, y] dx  +  
          n[x, y] dy = 
        (∫_( (Subscript[C, 2]))) m[x, y] dx  +  
          n[x, y] dy?

L.9)

Go with a given vector field 
       Field[x, y] = {m[x, y], n[x, y]}
with the extra information that Field[x, y] is a gradient field.
If  C is closed curve (like a deformed circle), then what do expect the value of 
       (∫_( C)) m[x, y] dx  +  
        n[x, y] dy
to be?

L.10)

What do you mean when you say that a given vector field 
       Field[x, y] = {m[x, y], n[x, y]}
is a gradient field?

L.11)

Given that 
       Field[x, y] = {m[x, y], n[x, y]}
is the gradient field of the function 
       f[x, y] = (e^(-(x^2)/2  -  (y^2)/4)),
exactly what are the formulas for m[x, y] and n[x, y]?

L.12)

Here are four vector fields:
       Field1[x, y] = {y (e^(x y)), x (e^(x y))},
       Field2[x, y] = {y, -x},
       Field3[x, y] = {Sin[2  x], Cos[5  y]}, and
       Field4[x, y] = {3  x -  2  y, -2 x +  5  y}.
All but one of these vector fields are gradient fields.  
Identify the oddball.

L.13)

If Field[x, y] is a gradient field, and C is a closed curve (like a deformed circle), then what is the net flow of F[x, y] along C?

L.14)

Two legitimate parameterizations of the circle C 
       (x^2) +  (y^2) = 16 are:
Parameterization 1:
       {x[t], y[t]} = {4  Sin[t], 4  Cos[t]} with 0 ≤ t ≤ 2  π.
Parameterization 2:
       {x[t], y[t]} = {4  Cos[t], 4  Sin[t]} with 0 ≤ t ≤ 2  π.
Which of these two parameterizations do you use to calculate
       (∮_( C)) - y dx  +  
        x dy?
Calculate by hand 
       (∮_( C)) - y dx  +  
        x dy.
What does the result tell you about the net flow of 
       Field1[x, y] = {-y, x} 
along this circle?
What does the result tell you about the net flow 
       Field2[x, y] = {x, y} 
across this circle?

L.15)

Here are three curves all parameterized to start at {0, 0} and end at {3, 9}:

\(Clear[x1, y1, x2, y2, x3, y3, t]; 
{x1[t_], y1[t_]} = {t, 3\ t}; 

    \({x2[t_], y2[t_]} = {t - t\ \((3 - t)\), 3\ t}; \)\){x3[t_], y3[t_]} = {t + t (3 - t), 
        3 t - 0.6 t (3 - t) + ((4 Sin[π t]^2)/(1 + (t^2)))}; 
    ParametricPlot[{{x1[t], y1[t]}, {x2[t], y2[t]}, {x3[t], y3[t]}}, {t, 
        0, 3}, PlotStyle 
        -> {{Thickness[0.006]}, {Thickness[0.01]}, {Thickness[0.013]}}, 
      AxesLabel -> {"x", "y"}, 
      Epilog -> {Text["start", {0, 0}, {0, -4}], 
          Text["end", {3, 9}, {0, 4}], Text["C1", {-0.5, 5.5}], 
          Text["C2", {1.8, 6}], Text["C3", {3.8, 5}]}];

Explain how you know before calculations begin that following three path integrals all calculate out to the same value:        
       (∫_( (Subscript[C, 1]))) 3  (x^2) (y^4) dx  +  
        4  (x^3) (y^3) dy
       (∫_( (Subscript[C, 2]))) 3  (x^2) (y^4) dx  +  
        4  (x^3) (y^3) dy
       (∫_( (Subscript[C, 3]))) 3  (x^2) (y^4) dx  +  
        4  (x^3) (y^3) dy.

L.16)

Does 
       Field[x, y] = {y Sin[x y], x Sin[x y]} 
pass the gradient test?
Does 
       Field[x, y] = {x Sin[x y], y Sin[x y]}
pass the gradient test?

L.17)

Why does Field[x, y] = {1 +  y, 3 +  x} pass the gradient test?
Come up with a function f[x, y] whose gradient is 
       Field[x, y] = {1 +  y, 3 +  x}.

L.18)

You are given: 
-> A vector field Field[x, y] = {m[x, y], n[x, y]},
-> a closed curve C (like a deformed circle), and 
-> a counterclockwise parameterization of C,    
       P[t] = {x[t], y[t]},
with P[t] sweeping out C exactly one time as t advances from tlow to thigh.
With these ingredients, you can make the following seven measurements: 
i)       (∮_( C)) 
        Field . outerunitnormal ds, 
ii)      (∮_( C)) m[x, y] dx  +  
        n[x, y] dy,
iii)     (∫_tlow^thigh) Field[x[t], y[t]].{x'[t],y'[t]}dt,
iv)      (∮_( C)) Field . dP,
v)      (∮_( C)) -n[x, y] dx  +  
        m[x, y] dy,
vi)      (∮_( C)) Field . unittan ds,
vii)    (∫_tlow^thigh) Field[x[t], y[t]].{y'[t],-x'[t]}dt.
Some of these measurements measure the net flow of Field[x, y] along C, and some measure the net flow of Field[x, y] across C.
Which are which?