Practice Problems for Exam 4
Contents
- 1(a): Line integral for scalar function
- 1(b): Work integral for vector field
- 1(c): Apply fundamental theorem of line integrals
- 2(a): Work integral for 2D vector field
- 2(b): Apply Green's theorem
- 3: Surface integral for scalar function
- 4(a): Flux surface integral for vector field.
- 4(b): Apply divergence theorem
1(a): Line integral for scalar function
Let C denote the helix given by (2*cos(t), 2*sin(t), t) for t in [0,2*pi]. Find the integral of (x+y+z) over the curve C.
syms x y z t real f = x + y + z; r = [2*cos(t),2*sin(t),t]; % parametrization r(t) rp = diff(r,t) % r'(t) normrp = simplify(norm(rp)) % ||r'|| fr = subs(f,{x,y,z},r) % substitute parametrization in f I = int(fr*normrp,t,0,2*pi)
rp = [ -2*sin(t), 2*cos(t), 1] normrp = 5^(1/2) fr = t + 2*cos(t) + 2*sin(t) I = 2*5^(1/2)*pi^2
1(b): Work integral for vector field
Find the work integral x*dx + y*dy + z*dz over the curve C.
F = [x,y,z] % vector field Fr = subs(F,{x,y,z},r) % substitute parametrization in F integrand = dot(Fr,rp) I = int(integrand,t,0,2*pi) % integrate dot product of F(r(t)) and r'(t)
F = [ x, y, z] Fr = [ 2*cos(t), 2*sin(t), t] integrand = t I = 2*pi^2
1(c): Apply fundamental theorem of line integrals
Show that the vector field from (b) is conservative. Find the integral W using the fundamental theorem of line integrals.
curl(F,[x y z]) % curl of F is (0,0,0), hence F is conservative f = potential(F,[x y z]) % find potential A = subs(r,t,0) % starting point of curve C B = subs(r,t,2*pi) % end point of curve C I = subs(f,{x,y,z},B) - subs(f,{x,y,z},A) % f(B) - f(A)
ans = 0 0 0 f = x^2/2 + y^2/2 + z^2/2 A = [ 2, 0, 0] B = [ 2, 0, 2*pi] I = 2*pi^2
2(a): Work integral for 2D vector field
Let C denote the closed curve in the plane given by x^2+y^2=4, traversed counterclockwise. Find the work integral (x-y)*dx+(x+y)*dy over the curve C.
syms x y t real F = [x-y,x+y]; % vector field F r = [2*cos(t),2*sin(t)]; % parametrization r(t) = (X,Y) rp = diff(r,t) % r'(t) Fr = subs(F,{x,y},r) % substitute parametrization in F integrand = simplify(dot(Fr,rp)) W = int( integrand,t,0,2*pi) % integrate dot product of F(r(t)) and r'(t)
rp = [ -2*sin(t), 2*cos(t)] Fr = [ 2*cos(t) - 2*sin(t), 2*cos(t) + 2*sin(t)] integrand = 4 W = 8*pi
2(b): Apply Green's theorem
Find the integral W from (a) using Green's theorem.
g = diff(F(2),x) - diff(F(1),y) % Find g = F2_x - F1_y syms r theta real X = r*cos(theta); Y = r*sin(theta); % polar coordinates gr = subs(g,{x,y},{X,Y}) % substitute polar coordinates in g W = int( int( g*r, r,0,2 ), theta,0,2*pi) % integrate g*r*dr*dtheta
g = 2 gr = 2 W = 8*pi
3: Surface integral for scalar function
Let Sigma be the part of the sphere x^2+y^2+z^2=4 with x>=0, y>=0, z>=0. Write the surface integral of x+y+z over Sigma as an iterated integral over theta,phi.
syms x y z phi theta real f = x + y + z r = [2*sin(phi)*cos(theta),2*sin(phi)*sin(theta),2*cos(phi)] % parametrization r(phi,theta) % for phi in [0,pi/2] and theta in [0,pi/2] rphi = diff(r,phi) % find partial derivatives rtheta = diff(r,theta) N = simplify(cross(rphi,rtheta)) % find cross product normN = simplify(norm(N)) % norm of cross product (can omit abs since phi is in [0,pi] fr = subs(f,{x,y,z},r) % substitute parametrization in f integrand = fr*normN % (can omit abs) I = int( int( integrand, phi,0,pi/2), theta,0,pi/2 )
f = x + y + z r = [ 2*cos(theta)*sin(phi), 2*sin(phi)*sin(theta), 2*cos(phi)] rphi = [ 2*cos(phi)*cos(theta), 2*cos(phi)*sin(theta), -2*sin(phi)] rtheta = [ -2*sin(phi)*sin(theta), 2*cos(theta)*sin(phi), 0] N = [ 4*cos(theta)*sin(phi)^2, 4*sin(phi)^2*sin(theta), 2*sin(2*phi)] normN = 4*abs(sin(phi)) fr = 2*cos(phi) + 2*cos(theta)*sin(phi) + 2*sin(phi)*sin(theta) integrand = 4*abs(sin(phi))*(2*cos(phi) + 2*cos(theta)*sin(phi) + 2*sin(phi)*sin(theta)) I = 6*pi
4(a): Flux surface integral for vector field.
Let Sigma denote the whole sphere x^2+y^2+z^2=4 and consider the vector field F=(x,y,z). Find the flux integral of F over Sigma.
F = [x,y,z] % vector field Fr = subs(F,{x,y,z},r) % substitute parametrization in F integrand = simplify(dot(Fr,N)) % dot product of F(r(t)) and cross(rphi,rtheta) I = int( int( integrand, phi,0,pi), theta,0,2*pi ) % now integrate over whole sphere
F = [ x, y, z] Fr = [ 2*cos(theta)*sin(phi), 2*sin(phi)*sin(theta), 2*cos(phi)] integrand = 8*sin(phi) I = 32*pi
4(b): Apply divergence theorem
Evaluate the integral I from (a) using the divergence theorem.
g = divergence(F,[x y z]) % find g = div F syms rho phi theta real r = [rho*sin(phi)*cos(theta),rho*sin(phi)*sin(theta),rho*cos(phi)] % spherical coordinates gr = subs(g,{x,y,z},r) % substitute spherical coordinates in g I = int( int( int( gr*rho^2*sin(phi), rho,0,2 ), phi,0,pi ), theta,0,2*pi)
g = 3 r = [ rho*cos(theta)*sin(phi), rho*sin(phi)*sin(theta), rho*cos(phi)] gr = 3 I = 32*pi