Mathematica needs the following package to be able to plot vector fields.

Needs["VectorFieldPlots`"]

Flow

Example from class

Find the flow of the velocity field F=<x+y,-(x^2)-(y^2)> along the path that is the top of the curve (x^2)+(y^2)=1 from (1,0) to (-1,0).

F={x+y,-(x^2)-(y^2)}
field=VectorFieldPlot[F,{x,-1,1},{y,0,1}]

r[t_]={Cos[t],Sin[t]}
curve=ParametricPlot[r[t],{t,0,Pi},PlotStyle->{Red,Thick}]

Show[curve,field]

Evaluate the integrand using the parameterization:

F=F/.x->r[t][[1]]/.y->r[t][[2]]

Integrate:

Integrate[F.r'[t],{t,0,Pi}]

Notice that the flow is negative, since the velocity field F is acting in a direction opposite to the tangent to the curve r'(t) over a large part of the curve. The flow measures how the vector field causes fluid to go around the curve.

Example

Find the flow of the velocity field F=<x,y> along the path that is the top of the curve (x^2)+(y^2)=1 from (1,0) to (-1,0).

F={x,y}
field=VectorFieldPlot[F,{x,-1,1},{y,0,1}]

r[t_]={Cos[t],Sin[t]}
curve=ParametricPlot[r[t],{t,0,Pi},PlotStyle->{Red,Thick}]

Show[curve,field]

Evaluate the integrand using the parameterization:

F=F/.x->r[t][[1]]/.y->r[t][[2]]

Integrate:

Integrate[F.r'[t],{t,0,Pi}]

Notice that the flow is zero, since the velocity field F is orthogonal to the tangent to the curve r'(t). Fluid would  not be going around the curve at all.

Flux

Example

Find the flux of the velocity field F=<x+y,-(x^2)-(y^2)> along the path that is the top of the curve (x^2)+(y^2)=1 from (1,0) to (-1,0).

F={x+y,-(x^2)-(y^2)}
field=VectorFieldPlot[F,{x,-1,1},{y,0,1}]

r[t_]={Cos[t],Sin[t]}
curve=ParametricPlot[r[t],{t,0,Pi},PlotStyle->{Red,Thick}]

Show[curve,field]

Evaluate the integrand using the formula we derived in class, but we still need to switch to the parameterization

F=F/.x->r[t][[1]]/.y->r[t][[2]]

Integrate using Flux=(∫_C) M dy - N dx :

F[[1]]*D[r[t][[2]],t]-F[[2]]*D[r[t][[1]],t]

Integrate[F[[1]]*D[r[t][[2]],t]-F[[2]]*D[r[t][[1]],t],{t,0,Pi}]

Notice that the flux is negative, since the velocity field F is mostly crossing the curve going down. The flux measures how the vector field causes fluid to go across the curve.

Example

Find the flow of the velocity field F=<-y,x> along the path that is the top of the curve (x^2)+(y^2)=1 from (1,0) to (-1,0).

F={-y,x}
field=VectorFieldPlot[F,{x,-1,1},{y,0,1}]

r[t_]={Cos[t],Sin[t]}
curve=ParametricPlot[r[t],{t,0,Pi},PlotStyle->{Red,Thick}]

Show[curve,field]

Evaluate the integrand using the formula we derived in class, but we still need to switch to the parameterization

F=F/.x->r[t][[1]]/.y->r[t][[2]]

Integrate using Flux=(∫_C) M dy - N dx :

F[[1]]*D[r[t][[2]],t]-F[[2]]*D[r[t][[1]],t]

Integrate[F[[1]]*D[r[t][[2]],t]-F[[2]]*D[r[t][[1]],t],{t,0,Pi}]

Notice that the flux is zero, since the velocity field F is following the curve exactly. The flux measures how the vector field causes fluid to go across the curve, and fluid would not cross the cruve for this velocity field.

Closed Path

Find the flux and circulation of F=<x,1> for the curve (x^2)+4(y^2)=1.

Sketch

F={x,1}
field=VectorFieldPlot[F,{x,-1,1},{y,-1,1}]

r[t_]={Cos[t],(1/2)Sin[t]}
curve=ParametricPlot[r[t],{t,0,2Pi},PlotStyle->{Red,Thick}]

Show[curve,field]

Circulation

Evaluate the integrand using the parameterization:

F=F/.x->r[t][[1]]/.y->r[t][[2]]

Integrate:

Integrate[F.r'[t],{t,0,2Pi}]

Flux

F=F/.x->r[t][[1]]/.y->r[t][[2]]

Integrate using Flux=(∫_C) M dy - N dx :

F[[1]]*D[r[t][[2]],t]-F[[2]]*D[r[t][[1]],t]

Integrate[F[[1]]*D[r[t][[2]],t]-F[[2]]*D[r[t][[1]],t],{t,0,2Pi}]

Closed Path

Find the flux and circulation of F=<y (x^2),y cos y> for the curve (x^2)+4(y^2)=1.

Sketch

F={y*(x^2),y*Cos[y]}
field=VectorFieldPlot[F,{x,-1,1},{y,-1,1}]

r[t_]={Cos[t],(1/2)Sin[t]}
curve=ParametricPlot[r[t],{t,0,2Pi},PlotStyle->{Red,Thick}]

Show[curve,field]

Circulation

Evaluate the integrand using the parameterization:

F=F/.x->r[t][[1]]/.y->r[t][[2]]

Integrate:

Integrate[F.r'[t],{t,0,2Pi}]

Notice that the flow is negative, which means the net flow around the region is acting in a clockwise direction (against the direction the curve C is traversed).

Flux

F=F/.x->r[t][[1]]/.y->r[t][[2]]

Integrate using Flux=(∫_C) M dy - N dx :

F[[1]]*D[r[t][[2]],t]-F[[2]]*D[r[t][[1]],t]

Integrate[F[[1]]*D[r[t][[2]],t]-F[[2]]*D[r[t][[1]],t],{t,0,2Pi}]

AWESOME!!