# MATH 251: Calculus 3, SET8

## 16: Vector Calculus

### 16.8: Stokes' Theorem

These problems are done with the CAS. See Hand Solutions for details.

#### 1. [1139/2]

We evaluate the surface integral of curl F by using Stokes' Theorem to compute the line integral of F along a paraboloid's boundary curve C, the unit circle in the xy-plane traversed counterclockwise as viewed from above.
syms F R r t x y z real
F = [x^2*sin(z) y^2 x*y], R = [cos(t) sin(t) 0] % vector field, curve
F =
R =
cFR = subs(F, [x y z], R) % Compose F with R.
cFR =
DR = diff(R,t) % Differentiate r w.r.t. t.
DR =
intg = expand( dot(cFR, DR) ) % integrand
intg =
I = int(intg, t, 0, 2*pi) % line integral of vector field along curve
I = 0
%
figure
fsurf(r*cos(t), r*sin(t), 1-r^2, [0 1 0 2*pi], 'MeshDensity', 10); hold on
fplot3(cos(t), sin(t), sym(0), [0 2*pi], 'm', 'LineWidth', 10)
axis equal; axis([-1 1 -1 1 0 1])
xticks(-1:1); yticks(-1:1); zticks(0:1)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1139/2')

#### 2. [1139/4]

Same drill as #1 for a cone whose boundary circle is traversed counterclockwise viewed looking down the positive x-axis toward the origin.
syms F R r t x y z real
F = [atan(x^2*y*z^2) x^2*y x^2*z^2], R = [2 2*cos(t) 2*sin(t)] % vector field, curve
F =
R =
cFR = subs(F, [x y z], R) % Compose F with R.
cFR =
DR = diff(R,t) % Differentiate r w.r.t. t.
DR =
intg = expand( dot(cFR, DR) ) % integrand
intg =
I = int(intg, t, 0, 2*pi) % line integral of vector field along curve
I = 0
%
figure
fsurf(r, r*cos(t), r*sin(t), [0 2 0 2*pi], 'MeshDensity', 10); hold on
fplot3(sym(2), 2*cos(t), 2*sin(t), [0 2*pi], 'm', 'LineWidth', 10)
axis equal; axis([0 2 -2 2 -2 2])
xticks(0:2); yticks(-2:2); zticks(-2:2)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1139/4'); view(38,26)

#### 3. [1139/6]

Same drill as #1 for a semiellipsoid with boundary circle traversed counterclockwise viewed looking down the positive y-axis toward the origin.
syms F R r t x y z real
F = [exp(x*y) exp(x*z) x^2*z], R = [cos(t) 0 sin(t)] % vector field, curve
F =
R =
cFR = subs(F, [x y z], R) % Compose F with R.
cFR =
DR = diff(R,t) % Differentiate r w.r.t. t.
DR =
intg = expand( dot(cFR, DR) ) % integrand
intg =
I = int(intg, t, 0, 2*pi) % line integral of vector field along curve
I = 0
%
figure
fsurf(r*cos(t), sqrt(4-4*r^2), r*sin(t), [0 1 0 2*pi], 'MeshDensity', 14); hold on
fplot3(cos(t), sym(0), sin(t), [0 2*pi], 'm', 'LineWidth', 10)
axis equal; axis([-1 1 0 2 -1 1])
xticks(-1:1); yticks(0:2); zticks(-1:1)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1139/6'); view(141,16)

#### 4. [1139/8]

We evaluate the line integral of F along the boundary C of a triangular patch by using Stokes' Theorem to compute the surface integral of curl F over the patch with upward pointing normal.
syms F R x y z real
F = [1 x+y*z x*y-sqrt(z)], R = [x y 1-3*x-2*y] % vector field, surface
F =
R =
c = curl(F, [x y z])' % the curl of F from 16.5
c =
ccR = subs(c, [x y z], R) % Compose curl F with R.
ccR =
Rx = diff(R,x), Ry = diff(R,y), n = cross(Rx,Ry) % Orientation OK? Yes, it points upward.
Rx =
Ry =
n =
intg = expand( dot(ccR, n) ) % integrand
intg =
I = int(int(intg, x, 0, (1-2*y)/3), y, 0, 1/2) % surface integral of curl F across surface
I =
I_appx = double(I)
I_appx = 0.0417
%
figure % triangular patch
X = [1/3 0 0 1/3]; Y = [0 1/2 0 0]; Z = [0 0 1 0];
fill3(X,Y,Z, 'c'); grid on; hold on
plot3(X,Y,Z, 'm', 'LineWidth', 10)
plot3([0 0.7], [0 0], [0 0], 'k', 'LineWidth', 2)
plot3([0 0], [0 0.7], [0 0], 'k', 'LineWidth', 2)
plot3([0 0], [0 0], [0 1.2], 'k', 'LineWidth', 2)
plot3(0,0,0, 'ro', 'MarkerFaceColor', 'r', 'MarkerSize', 14)
text(0.8,0,0, 'x', 'FontSize', 12)
text(0,0.8,0, 'y', 'FontSize', 12)
text(0,0,1.25, 'z', 'FontSize', 12)
axis equal; axis([0 0.7 0 0.7 0 1.2])
xticks([0 1/3]); yticks([0 1/2]); zticks([0 1])
xlabel('x'); ylabel('y'); zlabel('z')
title(' SET8, 1139/8'); view(112,19); alpha 0.5
axis off

#### 5. [1139/10]

We evaluate the line integral of F along the boundary C of a elliptical patch by using Stokes' Theorem to compute the surface integral of curl F over the patch with upward pointing normal.
syms F R r t theta x y z real
F = [2*y x*z x+y], R = [r*cos(theta) r*sin(theta) 2+r*sin(theta)] % vector field, surface
F =
R =
c = curl(F, [x y z])' % the curl of F from 16.5
c =
ccR = subs(c, [x y z], R) % Compose curl F with R.
ccR =
Rr = diff(R,r), Rtheta = diff(R,theta), n = simplify(cross(Rr,Rtheta)) % Orientation OK? Yes, it points up.
Rr =
Rtheta =
n =
intg = expand( dot(ccR, n) ) % integrand
intg =
I = int(int(intg, r, 0, 1), theta, 0, 2*pi) % surface integral of curl F across surface
I = Ï€
I_appx = double(I)
I_appx = 3.1416
%
figure
fsurf(R(1), R(2), R(3), [0 1 0 2*pi], 'MeshDensity', 12); hold on
fplot3(cos(t), sin(t), 2+sin(t), [0 2*pi], 'm', 'LineWidth', 10)
axis equal; axis([-1 1 -1 1 1 3])
xticks(-1:1); yticks(-1:1); zticks(1:3)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1139/10')

#### 6. [1139/12]

We evaluate the line integral of F along the boundary C of a surface patch by using Stokes' Theorem to compute the surface integral of curl F over the patch with upward pointing normal.
syms F R r t theta x y z real
F = [x^2*y x^3/3 x*y], R = [r*cos(theta) r*sin(theta) r^2*(-cos(2*theta))] % vector field, surface
F =
R =
c = curl(F, [x y z])' % the curl of F from 16.5
c =
ccR = subs(c, [x y z], R) % Compose curl F with R.
ccR =
Rr = diff(R,r), Rtheta = diff(R,theta), n = simplify(cross(Rr,Rtheta)) % Orientation OK? Yes, it points up.
Rr =
Rtheta =
n =
intg = expand( dot(ccR, n) ) % integrand
intg =
I = int(int(intg, r, 0, 1), theta, 0, 2*pi) % surface integral of curl F across surface
I = Ï€
I_appx = double(I)
I_appx = 3.1416
%
figure
fsurf(R(1), R(2), R(3), [0 1 0 2*pi], 'MeshDensity', 12); hold on
fplot3(cos(t), sin(t), -cos(2*t), [0 2*pi], 'm', 'LineWidth', 10)
axis equal; axis([-1 1 -1 1 -1 1])
xticks(-1:1); yticks(-1:1); zticks(-1:1)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1139/12')

#### 7. [1139/14]

We verify that Stokes' Theorem is true by showing that the relevant surface and line integrals give the same result for a paraboloid and its circular boundary.
syms F R r t theta x y z real
F = [-2*y*z y 3*x], R = [r*cos(theta) r*sin(theta) 5-r^2] % vector field, surface
F =
R =
c = curl(F, [x y z])' % the curl of F from 16.5
c =
ccR = subs(c, [x y z], R) % Compose curl F with R.
ccR =
Rr = diff(R,r), Rtheta = diff(R,theta), n = simplify(cross(Rr,Rtheta)) % Orientation OK? Yes, it points up.
Rr =
Rtheta =
n =
intg = expand( dot(ccR, n) ) % integrand
intg =
I = int(int(intg, r, 0, 2), theta, 0, 2*pi) % surface integral of curl F across surface
I =
I_appx = double(I)
I_appx = 25.1327
%
g = [2*cos(t) 2*sin(t) 1]
g =
cFg = subs(F, [x y z], g)
cFg =
Dg = diff(g,t)
Dg =
intg = dot(cFg,Dg)
intg =
LI = int(intg, t, 0, 2*pi)
LI =
LI_appx = double(LI)
LI_appx = 25.1327
%
figure
fsurf(R(1), R(2), R(3), [0 2 0 2*pi], 'MeshDensity', 12); hold on
fplot3(2*cos(t), 2*sin(t), sym(1), [0 2*pi], 'm', 'LineWidth', 10)
axis equal; axis([-2 2 -2 2 0 5])
xticks(-2:2); yticks(-2:2); zticks(0:5)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 1139/14')

#### 8. [1139/16]

We evaluate the line integral of F along the boundary C of a surface patch by using Stokes' Theorem to compute the surface integral of curl F over the patch with upward pointing normal.
syms x y z
F = [z -2*x 3*y], c = curl(F, [x y z])'
F =
c =
plane = x+y+z == 1, n = sym([1 1 1]/sqrt(3)), integrand = dot(c,n) % unit normal
plane =
n =
integrand =
% surface integral = I = 2/sqrt(3)*(surface area of patch enclosed by C)
% It does NOT depend on the shape of C or its location in the plane.

#### 9. [1139/17]

We'll compute work done by a force field F (a line integral) by using Stokes' Theorem to compute the surface integral of curl F.
syms F R x y z real
F = [z^2 2*x*y 4*y^2], R = [x y y/2] % vector field, planar surface (from data given in problem)
F =
R =
c = curl(F, [x y z])' % the curl of F from 16.5
c =
ccR = subs(c, [x y z], R) % Compose curl F with R.
ccR =