Section 16.1 homework
MAT329
Andy Long

#5, p. 1085

Clear[f,v,s,fx,fy,x,y]
v=VectorDensityPlot[{y/Sqrt[x^2+y^2],x/Sqrt[x^2+y^2]},{x,-3,3},{y,-3,3}];
s=StreamPlot[{y/Sqrt[x^2+y^2],x/Sqrt[x^2+y^2]},{x,-3,3},{y,-3,3}];
{v,s}
Show[v,s]

#18: This is the 3D vector field of a conservative field -- since it can be written as the gradient of (x^2+y^2+z^2)/2: answer is II:

VectorPlot3D[{x,y,z},{x,-3,3},{y,-3,3},{z,-3,3},VectorColorFunction->"DeepSeaColors"]

#20, p. 1086

r[x_,y_]:=Sqrt[x^2+y^2]
v=VectorDensityPlot[{(r[x,y]-2)r[x,y]x,(r[x,y]-2)r[x,y]y},{x,-3,3},{y,-3,3}];
s=StreamPlot[{(r[x,y]-2)r[x,y]x,(r[x,y]-2)r[x,y]y},{x,-3,3},{y,-3,3}];
{v,s}
Show[v,s]

#26, p. 1086

Clear[x,y,z]
z[x_,y_]:=Sqrt[x^2+y^2]
poten=ContourPlot[z[x,y],{x,-3,3},{y,-3,3}];
gradz={D[z[x,y],x],D[z[x,y],y]}
cons=VectorDensityPlot[gradz,{x,-3,3},{y,-3,3},MaxRecursion->4,ColorFunctionScaling->False,ColorFunction->Function[{x,y},Hue[z[x,y],{-3,3},{-3,3}]]];
Show[poten,cons]

f[x_,y_]:=Sqrt[x^2+y^2]
fx[x_,y_]=D[f[x,y],x]
fy[x_,y_]=D[f[x,y],y]
v=VectorDensityPlot[{fx[x,y],fy[x,y]},{x,-3,3},{y,-3,3}];
s=StreamPlot[{fx[x,y],fy[x,y]},{x,-3,3},{y,-3,3}];
{v,s}
Show[v,s]

#36, p. 1086

sp=StreamPlot[{1,x},{x,-3,3},{y,-3,3}];
vp=VectorPlot[{1,x},{x,-3,3},{y,-3,3}];
Show[sp,vp]

v=VectorDensityPlot[{1,x},{x,-3,3},{y,-3,3}];
s=StreamPlot[{1,x},{x,-3,3},{y,-3,3}];
{v,s}
Show[v,s]