MATH 251: Calculus 3, SET8

16: Vector Calculus

16.4: Green's Theorem

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

1. [1101/2]

A line integral of a vector field is computed directly and via Green's Theorem. The result is the same.
syms r t x y real
P = y, Q = -x, F = [P Q], r = [4*cos(t) 4*sin(t)]
P = y
Q = 
F = 
r = 
% (a) directly
cFr = subs(F, [x y], 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 along circle of radius 4 centered at origin
I = 
I_appx = double(I) % Approximate.
I_appx = -100.5310
% (b) via Green's Theorem
Qx = diff(Q,x), Py = diff(P,y)
Qx = 
Py = 1
intg = Qx - Py % integrand
intg = 
% The integral is -2*A where A is the area of the circular region enclosed.
I_via_GT = sym(-2 * pi*4^2)
I_via_GT = 
%
figure
T = linspace(0,2*pi); X = 4*cos(T); Y = 4*sin(T);
fill(X,Y,'g'); grid on; hold on % Of course: green for Green's Theorem!
plot(X,Y,'k', 'LineWidth', 3)
plot([-4 4], [0 0], 'k')
plot([0 0], [-4 4], 'k')
axis tight; axis equal; axis([-4 4 -4 4])
xticks(-4:2:4); yticks(-4:2:4)
xlabel('x'); ylabel('y')
title('SET8, 1101/2')

2. [1102/4]

Same drill as #1.
syms F r1 r2 r3 t x y real
P = x^2*y^2, Q = x*y, F = [P Q]
P = 
Q = 
F = 
% (a) directly
% Vector field, quarter circular arc, line segment:
r1 = [t t^2], r2 = [1-t, 1], r3 = [0 1-t]
r1 = 
r2 = 
r3 = 
cFr1 = subs(F, [x y], r1) % Compose F with r1.
cFr1 = 
Dr1 = diff(r1,t) % Differentiate r1 w.r.t. t.
Dr1 = 
cFr2 = subs(F, [x y], r2) % Compose F with r2.
cFr2 = 
Dr2 = diff(r2,t) % Differentiate r2 w.r.t. t.
Dr2 = 
cFr3 = subs(F, [x y], r3) % Compose F with r2.
cFr3 = 
Dr3 = diff(r3,t) % Differentiate r3 w.r.t. t.
Dr3 = 
intg1 = dot(cFr1, Dr1) % 1st integrand
intg1 = 
intg2 = dot(cFr2, Dr2) % 2nd integrand
intg2 = 
intg3 = dot(cFr3, Dr3) % 3rd integrand
intg3 = 0
I1 = int(intg1, t, 0, 1) % line integral of vector field along 1st piece
I1 = 
I2 = int(intg2, t, 0, 1) % line integral of vector field along 2nd piece
I2 = 
I3 = int(intg3, t, 0, 1) % line integral of vector field along 3rd piece
I3 = 0
I = I1 + I2 + I3 % Add up portions.
I = 
I_appx = double(I) % Approximate.
I_appx = 0.2095
% (b) via Green's Theorem
Qx = diff(Q,x), Py = diff(P,y)
Qx = y
Py = 
intg = Qx - Py % integrand
intg = 
I_via_GT = int(int(intg, y, x^2, 1), x, 0, 1) % Clearly Green's Theorem is preferable!
I_via_GT = 
%
figure
xs = linspace(0,1); ys = xs.^2; X = [xs 0 0]; Y = [ys 1 0];
fill(X,Y,'g'); grid on; hold on
plot(X,Y,'k', 'LineWidth', 3)
axis tight; axis equal; axis([0 1 0 1])
xticks(0:1); yticks(0:1);
xlabel('x'); ylabel('y')
title('SET8, 1102/4')

3. [1102/6]

Here we just use Green's Theorem
syms P Q x y
P = x^2 + y^2, Q = x^2 - y^2, intg = diff(Q,x) - diff(P,y)
P = 
Q = 
intg = 
I = int(int(intg, y, x/2, 1), x, 0, 2)
I = 0
%
figure
X = [0 2 0 0]; Y = [0 1 1 0];
fill(X,Y,'g'); grid on; hold on
plot(X,Y,'k', 'LineWidth', 3)
axis tight; axis equal; axis([0 2 0 1])
xticks(0:2); yticks(0:1);
xlabel('x'); ylabel('y')
title('SET8, 1102/6')

4. [1102/8]

Again, use GT.
syms P Q x y
P = y^4, Q = 2*x*y^3, intg = diff(Q,x) - diff(P,y), s = sqrt(2-2*y^2)
P = 
Q = 
intg = 
s = 
I = int(int(intg, x, -s, s), y, -1, 1)
I = 0
%
figure
T = linspace(0,2*pi); X = sqrt(2)*cos(T); Y = sin(T);
fill(X,Y,'g'); grid on; hold on
plot(X,Y,'k', 'LineWidth', 3)
plot([-sqrt(2) sqrt(2)], [0 0], 'k')
plot([0 0], [-1 1], 'k')
axis tight; axis equal; axis([-1.5 1.5 -1 1])
xticks(-1.5:0.5:1.5); yticks(-1:0.5:1)
xlabel('x'); ylabel('y')
title('SET8, 1102/8')

5. [1102/10]

G.T.
syms P Q r x y theta
P = 1-y^3, Q = x^3+exp(y^2), intg = diff(Q,x) - diff(P,y)
P = 
Q = 
intg = 
h = 3*r^2 % STP: Switch to Polar!
h = 
I = int(int(h*r, r, 2, 3), theta, 0, 2*pi)
I = 
I_appx = double(I)
I_appx = 306.3053
%
figure
fsurf(r*cos(theta), r*sin(theta), sym(0), 'g', [2 3 0 2*pi], 'EdgeColor', 'none'); hold on
plot3([-3 3], [0 0], [0 0], 'k')
plot3([0 0], [-3 3], [0 0], 'k')
axis tight; axis equal; axis([-3 3 -3 3 -1 1])
xticks(-3:3); yticks(-3:3)
xlabel('x'); ylabel('y')
title('SET8, 1102/10'); view(0,90)

6. [1102/12]

In problem statement, orientation is clockwise. We need counterclockwise for G.T., so negate integral.
syms P Q r x y theta
P = exp(-x) + y^2, Q = exp(-y) + x^2, intg = diff(Q,x) - diff(P,y)
P = 
Q = 
intg = 
I = -int(int(intg, y, 0, cos(x)), x, -pi/2, pi/2)
I = 
I_appx = double(I)
I_appx = 1.5708
%
figure
xs = linspace(-pi/2,pi/2); ys = cos(xs); X = [xs -pi/2]; Y = [ys 0];
fill(X,Y,'g'); grid on; hold on
plot(X,Y,'k', 'LineWidth', 3)
axis tight; axis equal; axis([-pi/2 pi/2 0 1])
xticks(-1.5:0.5:1.5); yticks(0:0.5:1);
xlabel('x'); ylabel('y')
title('SET8, 1102/12')

7. [1102/14]

G.T.
syms P Q x y
P = sqrt(x^2 + 1), Q = atan(x), intg = diff(Q,x) - diff(P,y)
P = 
Q = 
intg = 
I = int(int(intg, y, x, 1), x, 0, 1)
I = 
I_appx = double(I)
I_appx = 0.4388
%
figure
X = [0 1 0 0]; Y = [0 1 1 0];
fill(X,Y,'g'); grid on; hold on
plot(X,Y,'k', 'LineWidth', 3)
axis tight; axis equal; axis([0 1 0 1])
xticks(0:1); yticks(0:1);
xlabel('x'); ylabel('y')
title('SET8, 1102/14')

8. [1102/16]

A line integral of a vector field is computed directly and via Green's Theorem. The result is the same.
syms r x y real
P = 2*x - x^3*y^5, Q = x^3*y^8, F = [P Q], r = [cos(t), 2*sin(t)]
P = 
Q = 
F = 
r = 
% (a) directly
cFr = subs(F, [x y], 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 along circle of radius 4 centered at origin
I = 
I_appx = double(I) % Approximate.
I_appx = 21.9911
% (b) via Green's Theorem
s = 2*sqrt(1-x^2)
s = 
Qx = diff(Q,x), Py = diff(P,y)
Qx = 
Py = 
intg = Qx - Py % integrand
intg = 
I_via_GT = int(int(intg, y, -s, s), x, -1, 1)
I_via_GT = 
I_via_GT_appx = double(I_via_GT)
I_via_GT_appx = 21.9911
%
figure
T = linspace(0,2*pi); X = cos(T); Y = 2*sin(T);
fill(X,Y,'g'); grid on; hold on % Of course: green for Green's Theorem!
plot(X,Y,'k', 'LineWidth', 3)
plot([-1 1], [0 0], 'k')
plot([0 0], [-2 2], 'k')
axis tight; axis equal; axis([-1 1 -2 2])
xticks(-1:1); yticks(-2:2)
xlabel('x'); ylabel('y')
title('SET8, 1102/16')

9. [1102/18]

G.T.
syms P Q r x y theta
P = sin(x), Q = sin(y) + x*y^2 + 1/3*x^3, intg = diff(Q,x) - diff(P,y)
P = 
Q = 
intg = 
h = r^2 % STP: Switch to Polar!
h = 
I = int(int(h*r, r, 0,5), theta, 0, pi/2)
I = 
I_appx = double(I)
I_appx = 245.4369
%
figure
T = linspace(0,2*pi); xs = 5*cos(T); ys = 5*sin(T);
X = [xs 0 5]; Y = [ys 0 0]
Y = 1×102
0 0.3171 0.6330 0.9463 1.2557 1.5602 1.8583 2.1490 2.4310 2.7032 2.9645 3.2139 3.4504 3.6730 3.8807 4.0729 4.2486 4.4073 4.5482 4.6707 4.7745 4.8591 4.9240 4.9692 4.9943 4.9994 4.9843 4.9491 4.8940 4.8192 4.7250 4.6118 4.4800 4.3301 4.1628 3.9788 3.7787 3.5635 3.3338 3.0908 2.8353 2.5684 2.2911 2.0047 1.7101 1.4087 1.1016 0.7900 0.4753 0.1586
fill(X,Y,'g'); grid on; hold on % Of course: green for Green's Theorem!
plot(X,Y,'k', 'LineWidth', 3)
plot([0 5], [0 0], 'k', 'LineWidth', 3)
plot([0 0], [0 5], 'k', 'LineWidth', 3)
axis tight; axis equal; axis([0 5 0 5])
xticks(0:5); yticks(0:5)
xlabel('x'); ylabel('y')
title('SET8, 1102/18')

10. [1102/20]

We compute the area of an epicycloid by using Green's Theorem in reverse with the vector field to evaluate a line integral which gives us the desired area, dA .
syms P Q t u x y real
P = sym(0), Q = x, intg = diff(Q,x) - diff(P,y), F = [P Q]
P = 0
Q = x
intg = 1
F = 
r = [5*cos(t) - cos(5*t), 5*sin(t) - sin(5*t)] % epicycloid parameterization
r = 
% Compute line integral.
cFr = subs(F, [x y], r) % Compose F with r.
cFr = 
Dr = diff(r,t) % Differentiate r w.r.t. t.
Dr = 
intg = dot(cFr, Dr) % integrand
intg = 
A = int(intg, t, 0, 2*pi) % line integral along circle of radius 4 centered at origin
A = 
A_appx = double(A) % in cm^2
A_appx = 94.2478
%
figure
T = linspace(0,2*pi); X = 5*cos(T) - cos(5*T); Y = 5*sin(T) - sin(5*T);
fill(X,Y,'g'); grid on; hold on
plot(X,Y,'k', 'LineWidth', 3)
plot([-6 6], [0 0], 'k')
plot([0 0], [-6 6], 'k')
axis tight; axis equal; axis([-6 6 -6 6])
xticks(-6:3:6); yticks(-6:3:6)
xlabel('x'); ylabel('y')
title('SET8, 1102/20')