Example: Exercise 17, Section 16.9#Define the vector field:with(VectorCalculus): with(Student[VectorCalculus]): with(plots):F:=VectorField(<x*z^2, (1/2)*y^3+tan(z), x^2*z+y^2>);#Define the surface:S:=<sin(v)*sin(u),sin(v)*cos(u), cos(v)>; # u is between 0 and 2pi, v is 0 to Pi/2A:=fieldplot3d(F,x=-1..1,y=-1..1,z=0..1,color=black,fieldstrength=fixed);B:=plot3d(S,u=0..2*Pi,v=0..Pi/2);display3d(A,B,scaling=constrained);#Compute the divergence (we're converting to spherical coordinates as well):dF:=Divergence(F);dG:=subs({x=r*sin(v)*cos(u),y=r*sin(v)*sin(u),z=r*cos(v)},dF);int(int(int(dG*r^2*sin(v),r=0..1),u=0..2*Pi),v=0..Pi/2);