Divergence

Clear[x,y,z]

Needs["VectorAnalysis`"]

Element[x,Reals];
Element[y,Reals];
Element[z,Reals];

F1={0,1}

VectorPlot[F1,{x,-1,1},{y,-1,1},VectorPoints->10,VectorScale->Small,Axes->True,AxesLabel->{x,y}]

f1=Div[{0,1,0},Cartesian[x,y,z]]

Now try another vector field:

F2={0,Exp[-x^2]}

VectorPlot[F2,{x,-1,1},{y,-1,1},VectorPoints->10,VectorScale->Small,Axes->True,AxesLabel->{x,y}]

f2=Div[{0,Exp[-x^2],0},Cartesian[x,y,z]]

Now try another field:

F3={0,Exp[-y^2]}

VectorPlot[F3,{x,-1,1},{y,-1,1},VectorPoints->10,VectorScale->Small,Axes->True,AxesLabel->{x,y}]

f3=Div[{0,Exp[-y^2],0},Cartesian[x,y,z]]

Plot3D[f3,{x,-3,3},{y,-3,3},ColorFunction->Hue,AxesLabel->{x,y}]

Now try another vector field:

F4={x,y}

VectorPlot[F4,{x,-1,1},{y,-1,1},VectorPoints->10,VectorScale->Small,Axes->True,AxesLabel->{x,y}]

f4=Div[{x,y,0},Cartesian[x,y,z]]

Now try another vector field:

F6={-y,x}

VectorPlot[F6,{x,-1,1},{y,-1,1},VectorPoints->10,VectorScale->Small,Axes->True,AxesLabel->{x,y}]

f6=Div[{-y,x,0},Cartesian[x,y,z]]

Now try another vector field:

F8={Sin[x*y],y}

VectorPlot[F8,{x,-2,2},{y,-2,2},VectorPoints->10,VectorScale->Small,Axes->True,AxesLabel->{x,y}]

f8=Div[{Sin[x*y],y,0},Cartesian[x,y,z]]

Plot3D[f8,{x,-2,2},{y,-2,2},ColorFunction->Hue,AxesLabel->{x,y},BoxRatios->Automatic]

Now try another vector field:

F10={0,1,0}

VectorPlot3D[F10,{x,-5,5},{y,-5,5},{z,-5,5},VectorPoints->5,VectorScale->Small,Axes->True,AxesLabel->{x,y,z}]

f10=Div[{0,1,0},Cartesian[x,y,z]]

Now try another vector field.

F11={x,y,z}

VectorPlot3D[F11,{x,-5,5},{y,-5,5},{z,-5,5},VectorPoints->5,VectorScale->Small,Axes->True,AxesLabel->{x,y,z}]

f11=Div[{x,y,z},Cartesian[x,y,z]]

Now try another vector field:

f12=1/((x^2+y^2+z^2)^(1/2))

Efield=Grad[-f12,Cartesian[x,y,z]]

VectorPlot3D[Efield,{x,-5,5},{y,-5,5},{z,-5,5},VectorPoints->5,VectorScale->Small,Axes->True,AxesLabel->{x,y,z}]

f13=Div[Efield,Cartesian[x,y,z]]

Simplify[%]

Div[{1/r^2,0,0},Spherical[r,θ,ϕ]]