#Irina Mukhametzhanova, Section 24
#This homework is OK to post
#17.1 Homework
#Exercise 1:
#Green's Theorem states that, if we have a line integral of two functions P and Q, it can be rewritten as:
#Int(P*dx + Q*dy, over C) = Int(Int(dQ/dx - dP/dy), over A)
#Our functions P and Q are x*y and y, respectively. So, the needed partial derivatives are:
#dQ/dx = 0
#dP/dy = x
#Our x and y bounds is the unit circle. So, our final integral is:
#Int(Int((-1)*x,y=-sqrt(1-x^2)..sqrt(1-x^2)),x=-1..1)
#We can convert this to polar coordinates to make integrating easier. So, since x=r*cos(theta) and
#y = r*sin(theta):
#Int(Int((-1)*r^2*cos(theta),r=0..1),theta=0..2*Pi) = Int(((-1/3)*r^3*cos(theta),r=0..1),theta=0..2*Pi) =
# = Int((-1/3)*cos(theta),theta=0..2*Pi) = (-1/3)*sin(theta),theta=0..2*Pi = 0
#Now, we can get this result another way to verify the theorem. We can use the fact that:
#Int(R*dx + Q*dy, over C) = Int(F(r(t))*dr,dt), where r is the path, and F is
.
#We can use the fact that the unit circle of radius 1 can be represented parametrically as:
#x = cos(t), y = sin(t), t=0..2*Pi
#So, we can find dr by taking the derivative of the path w.r.t. t and multiplying it by dt:
#dr = <-sin(t), cos(t)>*dt
#And F(r(t)) is equal to:
#F(r(t)) =
#Using our t bounds, our final integral is:
#Int(cos(t)*sin(t)*(-1)*sin(t) + sin(t)*cos(t),t=0..2*Pi)
#We can use Maple to solve the problem:
int(cos(t)*sin(t)*(-1)*sin(t) + sin(t)*cos(t),t=0..2*Pi);
#Result: 0
#ANSWER: Because the results match, the Green's Theorem is proven to be true
#Exercise 3:
#Using Green's Theorem, we can rewrite the function as:
#Int(y^2*dx + x^2*dy, over C) = Int(d/dx(x^2) - d/dy(y^2), over A) =
# = Int(2*x - 2*y, over A)
#Our region A is stated in the question, and is 0<=x<=1 and 0<=y<=1. So, our final integral is:
#Int(Int(2*x - 2*y, x=0..1),y=0..1) = Int((x^2 - 2*y*x,x=0..1),y=0..1) =
# = Int(1 - 2*y,y=0..1) = y - y^2,y=0..1 = 1-1 = 0
#ANSWER: The value of the line integral is 0
#Exercise 5
#Using Green's Theorem, we can rewrite the function as:
#Int(x^2*y*dx + 0*dy, over C) = Int(d/dx(0) - d/dy(x^2*y), over A) =
# = Int((-1)*x^2, over A)
#Our region A is stated in the question, and is a unit circle of radius 1. So, our bounds are
#-sqrt(1-x^2)<=y<=sqrt(1-x^2), -1<=x<=1. Our final integral is:
#Int(Int((-1)*x^2,y=-sqrt(1-x^2)..sqrt(1-x^2)),x=-1..1)
#To make integration easier, we can rewrite this using polar coordinates. If x=r*cos(theta),
#y=r*sin(theta), and dA = r*dr*dtheta, then our new integral is:
#Int(Int((-1)*r^3*cos(theta)^2,r=0..1),theta=0..2*Pi) =
# = Int(((-1/4)*r^4*cos(theta)^2,r=0..1),theta=0..2*Pi) =
# = Int((-1/4)*cos(theta)^2,theta=0..2*Pi)
#Use Maple for the last part:
int((-1/4)*cos(theta)^2,theta=0..2*Pi);
#Result: (-1)*Pi/4
#ANSWER: The value of the line integral is (-1)*Pi/4
#Exercise 7:
#Using Green's Theorem, we can rewrite the function as:
#Int(x^2*dx + x^2*dy, over C) = Int(d/dx(x^2) - d/dy(x^2), over A) =
# = Int(2*x, over A)
#To find the region A and its bounds, we can plot it first:
plot({x,x^2},x=0..1);
#If we were to draw a vertical line from bottom to top, we would first pass y=x^2 and then y=x. So,
#our y-bounds are x^2<=y<=x, and our x-bounds are 0<=x<=1. Our final integral is:
#Int(Int(2*x,y=x^2..x),x=0..1) = Int((2*x*y,y=x^2..x),x=0..1) =
# = Int(2*x^2 - 2*x^3,x=0..1) = (2/3)*x^3 - (1/2)*x^4,x=0..1 = 2/3 - 1/2 = (4-3)/6 = 1/6
#ANSWER: The value of the line integral is 1/6
#Exercise 9:
#Using Green's Theorem, we can rewrite the function as:
#Int(exp(x+y)*dx + exp(x-y)*dy, over C) = Int(d/dx(exp(x-y)) - d/dy(exp(x+y)), over A) =
# = Int(exp(x-y) - exp(x+y), over A)
#Note that because orientation is clockwise (negative), we need to reverse the integral:
#Int(exp(x-y) - exp(x+y), over A) -> Int(exp(x+y) - exp(x-y), over A)
#We need to find the A region. First, let's plot and connect all of the four points:
plot([[0, 0], [2, 2], [4, 2], [2, 0], [0, 0]], scaling = constrained);
#We can see the lines y=x, y=x-2, y=2 and y=0. If we draw a line from left to right, we will
#reach y=x first and then y=x-2. So, our x-bounds are y<=x<=y+2, and our y-bounds are 0<=y<=2.
#Our final integral is:
#Int(Int(exp(x+y) - exp(x-y),x=y..y+2),y=0..2) = Int((exp(x+y) - exp(x-y),x=y..y+2),y=0..2) =
# = Int(exp(2*y+2) - exp(2) - exp(2*y) + exp(0),y=0..2) =
# = Int(exp(2*y+2) - exp(2) - exp(2*y) + 1,y=0..2) = (1/2)*exp(2*y+2) - y*exp(2) - (1/2)*exp(2*y) + y,y=0..2 =
# = (1/2)*exp(6) - 2*exp(2) - (1/2)*exp(4) + 2 - (1/2)*exp(2) + 0 +(1/2)*exp(0) - 0 =
# = (1/2)*exp(6) - (5/2)*exp(2) - (1/2)*exp(4) + 5/2 = (1/2)*(exp(6) - 5*exp(2) - exp(4) + 5) =
# = (1/2)*(exp(4)*(exp(2)-1) - 5*(exp(2)-1)) = (1/2)*(exp(4)-5)*(exp(2)-1)
#ANSWER: The value of the line integral is (1/2)*(exp(4)-5)*(exp(2)-1)
#Exercise 13:
#We cannot use the theorem for the non-closed path ABCD. However, we can use the fact that:
#Integral of closed path ABCDA = Integral of non-closed path ABCD + Integral of segment DA
#First, let's use the Green's Theorem for the closed path ABCDA. We can rewrite the integral as:
#Int((sin(x)+y)*dx + (3*x+y)*dy, over C) = Int(d/dx(3*x+y) - d/dy(sin(x)+y), over A) =
# = Int(3 - 1, over A) = Int(2, over A)
#The area integral of a constant is the area of the region multiplied by that constant. So, the area of the trapesoid is:
#h*(b1+b2)/2 = 2*(2+6)/2 = 8
#And times the constant is:
#8*2 = 16
#Next, we find the integral over the line segment DA:
#dx = 0, and x = 0. So,
#Int((sin(x)+y)*dx + (3*x+y)*dy, over C) = Int(y*dy,y=6..0) = (1/2)*y^2,y=6..0 = -18
#Finally, find the line integral over the path ABCD:
#16--18 = 34
#ANSWER: The line integral of the non-closed path is 34
#17.2 Homework:
#Exercise 1:
#Stokes' Theorem states that:
#Int(curl(F)) = Int(F . dr, over C)
#So first, we need to find curl(F), or delta x F:
#delta x F = |i j k |
# |d/dx d/dy d/dz|
# |2*x*y x y+z | =
# = i*(d/dy(y+z) - d/dz(x)) - j*(d/dx(y+z) - d/dz(2*x*y)) + k*(d/dx(x) - d/dy(2*x*y)) =
# = i*(1) - j*(0) + k*(1-2*x) = <1, 0, 1-2*x>
#We can now plug it into the formula for the surface integral, Int(F . dr, over C), since it is now a new vector field.
#Int(-P*dg/dx - Q*dg/dy + R, over D), where P=F[1], Q=F[2], and R=F[3]. R is positive because
#it is oriented counterclockwise.
#Before we can write our integral, we need to fing g(x,y) and the integral's bounds.
#Because g(x,y) = z, and our z = 1 - x^2 - y^2, so, dg/dx = -2*x and dg/dy = -2*y
#Our x and y bounds would be the projection of the sphere of radius 1 onto the xy-plane. So, they are -sqrt(1-x^2)<=y<=sqrt(1-x^2), and
#-1<=x<=1.
#So, our final integral is:
#Int(Int(-(1)*(-2)*x - (0)*(-2)*y + (1-2*x),y=-sqrt(1-x^2)..sqrt(1-x^2)),x=-1..1) = Int(Int(2*x+1-2*x,y=-sqrt(1-x^2)..sqrt(1-x^2)),x=-1..1) =
# = Int(Int(1,y=-sqrt(1-x^2)..sqrt(1-x^2)),x=-1..1)
#The area integral of a constant is the area of the region times that constant. So, the area of our circle is Pi*(1)^2 = Pi, and the value of
#our surface integral is, therefore, also Pi.
#Finally, to verify the theorem, we need to take the line of the initial vector itself. Our path is a circle of radius 1, so:
#x=cos(t), y=sin(t), z=0, t=0..2*Pi
#Find F(r(t)) . dr:
#F(r(t)) = <2*cos(t)*sin(t),cos(t),sin(t)>
#dr = <(-1)*sin(t), cos(t), 0>*dt
#F(r(t)) . dr = (-2)*cos(t)*sin(t)^2 + cos(t)^2
#Our final line integral is:
#Int((-2)*cos(t)*sin(t)^2 + cos(t)^2,t=0..2*Pi)
#Use Maple to get the answer:
int(-2*cos(t)*sin(t)^2 + cos(t)^2, t = 0 .. 2*Pi);
#Result: Pi
#ANSWER: Because the results match, the Stokes' Theorem is proven to be true
#Exercise 3:
#Stokes' Theorem states that:
#Int(curl(F)) = Int(F . dr, over C)
#So first, we need to find curl(F), or delta x F:
#delta x F = |i j k |
# |d/dx d/dy d/dz|
# |exp(y-z) 0 0 | =
# = i*(d/dy(0) - d/dz(0)) - j*(d/dx(0) - d/dz(exp(y-z))) + k*(d/dx(0) - d/dy(exp(y-z))) =
# = i*(0) - j*(0+exp(y-z)) + k*(0-exp(y-z)) = <0, (-1)*exp(y-z), (-1)*exp(y-z)>
#We can now plug it into the formula for the surface integral, Int(F . dr, over C), since it is now a new vector field.
#Int(-P*dg/dx - Q*dg/dy + R, over D), where P=F[1], Q=F[2], and R=F[3]. R is positive because
#it is oriented counterclockwise.
#Before we can write our integral, we need to fing g(x,y) and the integral's bounds.
#Because g(x,y) = z, and our z is a constant (1), so, dg/dx = 0 and dg/dy = 0
#Our x and y bounds are listed in the question, and they are 0<=x<=1 and 0<=y<=1.
#So, our final integral is:
#Int(Int(-(0)*0 - ((-1)*exp(y-z))*0 - exp(y-z),y=0..1),x=0..1) = Int(Int((-1)*exp(y-z),y=0..1),x=0..1) =
# = Int(Int((-1)*exp(y-1),y=0..1),x=0..1) = Int(((-1)*exp(y-1),y=0..1),x=0..1) =
# = Int(exp(-1) - exp(0),x=0..1) = Int(exp(-1) - 1, x=0..1) = x*(exp(-1)-1),x=0..1 = exp(-1)-1
#Finally, to verify the theorem, we need to take the line of the initial vector itself. We have 4 paths:
#Path 1: x=1, y=t, z=1, t=0..1
#Path 2: x=1-t, y=1, z=1, t=0..1
#Path 3: x=0, y=1-t, z=1, t=0..1
#Path 4: x=t, y=0, z=1, t=0..1
#Find F(r(t)) . dr for each path:
#Path 1:
#F(r(t)) =
#dr = <0, 1, 0>*dt
#F(r(t)) . dr = 0
#Path 2:
#F(r(t)) = = <1,0,0>
#dr = <-1,0,0>*dt
#F(r(t)) . dr = -1
#Path 3:
#F(r(t)) =
#dr = <0, -1, 0>*dt
#F(r(t)) . dr = 0
#Path 4:
#F(r(t)) =
#dr = <1,0,0>*dt
#F(r(t)) . dr = exp(-1)
#Add all of the non-zero line integrals together:
#Int(-1,t=0..1) + Int(exp(-1),t=0..1) = -t(t=0..1) + t*exp(-1)(t=0..1) = -1 + exp(-1) = exp(-1)-1
#ANSWER: Because the results match, the Stokes' Theorem is proven to be true
#Exercise 5:
#curl(F) = delta x F = |i j k |
# |d/dx d/dy d/dz |
# |exp(z^2)-y exp(z^3)+x cos(x*z)| =
# = i*(d/dy(cos(x*z)) - d/dz(exp(z^3)+x)) - j*(d/dx(cos(x*z)) - d/dz(exp(z^2)-y)) + k*(d/dx(exp(z^3)+x) - d/dy(exp(z^2)-y)) =
# = i*(0 - 3*z^2*exp(z^3)) - j*((-1)*z*sin(x*z) - 2*z*exp(z^2)) + k*(1+1) = <(-3)*z^2*exp(z^3), z*sin(x*z) + 2*z*exp(z^2), 2>
#The parametrization of the path would be:
#x=cos(t), y=sin(t), z=0, t=0..2*Pi
#Next, we need to find F(r(t)) . dr:
#F(r(t)) = = <1-sin(t), 1+cos(t), 1>
#dr = <(-1)*sin(t), cos(t), 0>
#F(r(t)) . dr = sin(t)^2 - sin(t) + cos(t)^2 + cos(t) = cos(t) - sin(t) + 1
#Using our t-bounds, our final line integral is:
#Int(cos(t) - sin(t) + 1, t=0..2*Pi) = sin(t) + cos(t) + t, t=0..2*Pi = 0 + 1 + 2*Pi - 0 - 1 - 0 = 2*Pi
#ANSWER: The value of the line integral is 2*Pi
#Exercise 9:
#By looking at the vector field, we can see that it is a gradient vector of f=x*y*z. So, curl(F) = 0, and, therefore, its line integral
#would also be equal to 0
#ANSWER: The value of the line integral is 0
#Exercise 11:
#curl(F) = delta x F = |i j k |
# |d/dx d/dy d/dz|
# |3*y -2*x 3*y | =
# = i*(d/dy(3*y) - d/dz(-2*x)) - j*(d/dx(3*y) - d/dz(3*y)) + k*(d/dx(-2*x) - d/dy(3*y)) =
# = i*(3) - j*(0) + k*(-2-3) = <3,0,-5>
#We can now plug it into the formula for the surface integral, Int(F . dr, over C), since it is now a new vector field.
#Int(-P*dg/dx - Q*dg/dy + R, over D), where P=F[1], Q=F[2], and R=F[3]. R is positive because
#it is oriented counterclockwise.
#Before we can write our integral, we need to fing g(x,y) and the integral's bounds.
#Because g(x,y) = z, and our z is a constant (2), so, dg/dx = 0 and dg/dy = 0
#Our x and y bounds are listed in the question, and it is a disk of radius 3. So, our bounds are y=-sqrt(9-x^2)..sqrt(9-x^2) and x=-3..3.
#Our final integral is:
#Int(Int(-3*0 - 0*0 - 5,y=-sqrt(9-x^2)..sqrt(9-x^2)),x=-3..3) = Int(Int(-5,y=-sqrt(9-x^2)..sqrt(9-x^2)),x=-3..3)
#The area integral of a constant is that constant times the area of the region. The area is Pi*(3^2) = 9*Pi, so, our surface integral
#is equal to -5*9*Pi = -45*Pi
#ANSWER: The value of the surface integral is -45*Pi
#Exercise 13:
#curl(F) = delta x F = |i j k |
# |d/dx d/dy d/dz|
# |y z x | =
# = i*(d/dy(x) - d/dz(z)) - j*(d/dx(x) - d/dz(y)) + k*(d/dx(z) - d/dy(y)) =
# = i*(-1) - j*(1) + k*(-1) = <-1,-1,-1>
#We can now plug it into the formula for the surface integral, Int(F . dr, over C), since it is now a new vector field.
#Int(-P*dg/dx - Q*dg/dy + R, over D), where P=F[1], Q=F[2], and R=F[3]. R is positive because
#it is oriented counterclockwise.
#Before we can write our integral, we need to fing g(x,y) and the integral's bounds. We can get the surface by finding the equation of a plane that
#passes through those three points. We first need any two vectors on the plane, so, take two pairs of points out of the three given:
#v1 = <3-0,0-0,0-0> = <3,0,0>
#v2 = <0-3,3-0,3-0> = <-3,3,3>
#Find a vector perpendicular to them both - or normal to the plane:
#v1 x v2 = | i j k|
# | 3 0 0|
# |-3 3 3| = i*(0) - j*(9) + k*(9) = <0,-9,9>
#Now, use the normal vector and any point on the plane to make an equation:
#0*(x-0) - 9*(y-0) + 9*(z-0) = 0
-9*y + 9*z = 0
9*z = 9*y
#z = y
#Because g(x,y) = z, and our z = y, so, dg/dx = 0 and dg/dy = 1
#Our x and y bounds come from the projection of the plane onto the xy-plane. We would have three lines - y=x, y=0, and x=3. So, our bounds are
#0<=y<=x and 0<=x<=3. Our integral is:
#Int(Int(1*0 + 1*1 - 1,y=0..x),x=0..3) = Int(Int(0,y=0..x),x=0..3) = 0
#ANSWER: The value of the surface integral is 0