> #sfb November 14, 2002 > #Test 3 next Thurday, 21 Nov > #HW 10 Answers > #19.1 problems 1 & 2 > with(linalg); > F1:=vector([z,0,0]);F2:=vector([-z,0,x]); > #a -- z is positive > nor:=vector([1,0,0]);dotprod(nor,F1,orthogonal);dotprod(nor,F2,orthogonal); > #b -- z is negative > nor:=vector([1,0,0]);dotprod(nor,F1,orthogonal);dotprod(nor,F2,orthogonal); > #c -- x is positive > nor:=vector([0,0,-1]);dotprod(nor,F1,orthogonal);dotprod(nor,F2,orthogonal); > #d -- x is positive > nor:=vector([0,0,-1]);dotprod(nor,F1,orthogonal);dotprod(nor,F2,orthogonal); > #e > nor:=vector([0,1,0]);dotprod(nor,F1,orthogonal);dotprod(nor,F2,orthogonal); > #19.2 #8 NOTE F restricted to the Surface S, oriented toward z-axis > f:=y^2+5;F:=vector([0,-y,z]);Frestricted:=vector(subs(z=f,[0,-y,z])); > dA:=vector([-diff(f,x),-diff(f,y),1]); > dotprod(Frestricted,dA,orthogonal); > Int(Int(dotprod(Frestricted,dA,orthogonal),x=-2..1),y=0..1)=int(int(dotprod(Frestricted,dA,orthogonal),x=-2..1),y=0..1); > #19.3 #1 NOTE F restricted to the Surface S > r:=[s+t,s-t,s^2+t^2]; > diff(r,s); > diff(r,t); > crossprod(diff(r,s),diff(r,t)); > #this points away from z-axis > dA:=crossprod(diff(r,t),diff(r,s)); > F:=[0,0,z];Frestricted:=subs({x=s+t,y=s-t,z=s^2+t^2},F); > intergrad:=dotprod(Frestricted,dA); > Int(Int(intergrad,s=0..1),t=0..1)=int(int(intergrad,s=0..1),t=0..1); > plot3d(r,s=0..1,t=0..1,axes=normal,labels=["x","y","z"]); > #20.1 #4, 5, 10 > diverge([-x,y,0],[x,y,z]);diverge([-y,x,0],[x,y,z]);diverge([-x+y,y+z,-z+x],[x,y,z]); > #20.3 #1 2 > curl([x^2-y^2,2*x*y,0],[x,y,z]);curl([x^2,y^3,z^4],[x,y,z]); > #That ends the homework NOTE 0 != [0,0,0] > #Visualizing 3d vector fields is hard > with(plots); > fieldplot3d([x,y,z],x=-3..3,y=-3..3,z=-3..3,axes=boxed); > fieldplot3d([x,y,z],x=-3..3,y=-3..3,z=-3..3,grid=[4,4,4],color=black,arrows=THICK,axes=boxed,scaling=constrained); > > > # Some problems from the book > with(linalg):with(plots): > #19.2 #2 -- S is the surface x+y+z=1 over rect x=0..2, y=0..3 orientated upward > F:=[x,y,z];f:=1-x-y;#So the surface is defined as z = f(x,y) > surf:=plot3d(f,x=0..2,y=0..3,axes=BOXED):surf; > field:=fieldplot3d(F,x=0..2,y=0..3,z=-4..1,grid=[4,4,4],color=black,arrows=THICK):field; > display(surf,field); > dA:=[-Diff('f',x),-Diff('f',y),1]; > dA:=[-diff(f,x),-diff(f,y),1]; > Int('F_dot',A=S..'flux'); > Fsurf:=subs(z=f,F); > integrand:=dotprod(Fsurf,dA,orthogonal);integrand:=x+y+(1-x-y); > Int('F_dot',A=S..'flux')=int(int(integrand,x=0..2),y=0..3); > #19.2 #11 S is the hemisphere x^2+y^2+z^2=9 z>=0 oriented upward > F:=[x*z,0,y]; > f:=sqrt(9-x^2-y^2); > surf:=plot3d(f,x=-3..3,y=-3..3,axes=BOXED):surf; > field:=fieldplot3d(F,x=-3..3,y=-3..3,z=0..3,grid=[4,4,4],color=black,arrows=THICK):field; > display(surf,field); > dA:=[-diff(f,x),-diff(f,y),1];Fsurf:=subs(z=f,F); > integrand:=dotprod(Fsurf,dA,orthogonal); > #integrate x^2+y over x^2+y^2<=9 > r:='r'; > Int(Int(((r*cos(t))^2+r*sin(t))*r,r=0..3),t=0..2*Pi)= > int(int(((r*cos(t))^2+r*sin(t))*r,r=0..3),t=0..2*Pi); > > #Use the sphere formula > Fsurf:=subs({x=3*sin(h)*cos(t),y=3*sin(h)*sin(t),z=3*cos(h)},F); > dA:=[sin(h)*cos(t),sin(h)*sin(t),cos(t)]; > integrand:=dotprod(Fsurf,dA,orthogonal); > Int(Int(integrand*9*sin(h),h=0..Pi/2),t=0..2*Pi)= > int(int(integrand*9*sin(h),h=0..Pi/2),t=0..2*Pi); > #19.review #19 S is the cone z = sqrt(x^2+y^2) over quarter of unit circle in 1st quad orientated upward > F:=[x^2,y^2,z];f:=sqrt(x^2+y^2);dA:=[-diff(f,x),-diff(f,y),1];Fsurf:=subs(z=f,F); > integrand:=dotprod(Fsurf,dA,orthogonal); > int(int(r*(-(r*cos(t))^3/r-(r*sin(t))^3/r+r),r=0..1),t=0..Pi/2); > #20.4 #8 verify Stokes Thm, S is z=1-x^2-y^2,z>=0 orientated upward > F:=[y,z,x]; > curlF:=curl(F,[x,y,z]); > X:=cos(t);Y:=sin(t);Z:=0; > R:=[X,Y,Z]; > dr:=diff(R,t); > Fline:=subs({x=X,y=Y,z=Z},F); > lineIntegrand:=dotprod(Fline,dr,orthogonal); > Int(F_dot,'r'=C..line)=int(lineIntegrand,t=0..2*Pi); > f:=1-x^2-y^2; > Gsurf:=subs(z=f,curlF); > dA:=[-diff(f,x),-diff(f,y),1]; > surfIntegrand:=dotprod(Gsurf,dA,orthogonal); > Int('F_dot',A=S..'flux')=int(int(surfIntegrand,x=-sqrt(1-y^2)..sqrt(1-y^2)),y=-1..1); > Int('F_dot',A=S..'flux')=int(int(subs({x=cos(t),y=sin(t)},surfIntegrand)*r,r=0..1),t=0..2*Pi); > #Old Test, Same F, S is z=2*x+3*y over x=0..2, y=0..3 [Use Stokes to compute line int] WE must compute the surface integral, the flux > F;curlF; > f:=2*x+3*y;dA:=[-diff(f,x),-diff(f,y),1];Gsurf:=subs(z=f,curlF);surfIntegrand:=dotprod(Gsurf,dA,orthogonal); > int(int(surfIntegrand,x=0..2),y=0..3); > #C_1 > X:=t;Y:=0;Z:=2*t;R:=[X,Y,Z]; > dr:=diff(R,t);Fline:=subs({x=X,y=Y,z=Z},F);lineIntegrand:=dotprod(Fline,dr,orthogonal); > int(lineIntegrand,t=0..2); > #Old Test, Use Diverence Thm, V is cylinder x^2+y^2<=1,0<=z<=3, S is boundary of V, with outward normal, compute flux int over S of F > F:=[x*y^2,x*z^2,x^2*z]; > diverge(F,[x,y,z]); > Int(Int(Int(r^2*r,r=0..1),z=0..3),theta=0..2*Pi)=int(int(int(r^2*r,r=0..1),z=0..3),t=0..2*Pi); > >