# 미분적분학실습2-Week-15

## 1294 days ago by jhlee2chn

15.4. Green’s Theorem

Ex. 1

var('x, y') P(x, y) = x^4 Q(x, y) = x*y dP = diff(P, y) dQ = diff(Q, x) integral(integral(dQ - dP, y, 0, 1 - x), x, 0, 1)
 1/6 1/6
var('t') A = vector([0, 0]) B = vector([1, 0]) C = vector([0, 1]) r1 = (1 - t)*A + t*B u, v = r1 du = diff(u, t) dv = diff(v, t) c1 = integral(P(u, v)*du + Q(u, v)*dv, t, 0, 1) print c1
 1/5 1/5
r2 = (1 - t)*B + t*C u, v = r2 du = diff(u, t) dv = diff(v, t) c2 = integral(P(u, v)*du + Q(u, v)*dv, t, 0, 1) print c2
 -1/30 -1/30
r3 = (1 - t)*C + t*A u, v = r3 du = diff(u, t) dv = diff(v, t) c3 = integral(P(u, v)*du + Q(u, v)*dv, t, 0, 1) print c3
 0 0
print c1 + c2 + c3
 1/6 1/6

Ex. 2

var('x, y, r, t') P(x, y) = 3*y - exp(sin(x)) Q(x, y) = 7*x + sqrt(y^4 + 1) dP = diff(P, y) dQ = diff(Q, x) u = r*cos(t) v = r*sin(t) integral(integral((dQ(u, v) - dP(u, v))*r, r, 0, 3), t, 0, 2*pi)
 36*pi 36*pi

Ex. 3

var('x, y, a, b, t') u = a*cos(t) v = b*sin(t) du = diff(u, t) dv = diff(v, t) 1/2*integral(u*dv - v*du, t, 0, 2*pi)
 pi*a*b pi*a*b

Ex. 4

var('x, y, r, t') P(x, y) = y^2 Q(x, y) = 3*x*y dP = diff(P, y) dQ = diff(Q, x) f = dQ - dP u = r*cos(t) v = r*sin(t) integral(integral(f(u, v)*r, r, 1, 2), t, 0, pi)
 14/3 14/3

Ex. 5

var('x, y') F = vector([-y/(x^2 + y^2), x/(x^2 + y^2)]) P(x, y) = F[0] Q(x, y) = F[1] dP = diff(P, y) dQ = diff(Q, x) f = (dQ - dP).simplify_full() print f
 0 0
var('a, t') r = vector([a*cos(t), a*sin(t)]) dr = diff(r, t) integral((F(x = r[0], y = r[1]).inner_product(dr)).simplify_full(), t, 0, 2*pi)
 2*pi 2*pi

Exercise 1

var('x, y') implicit_plot(4*x^2 + y^2 == 4, (x, -2, 2), (y, -2, 2))
P(x, y) = 2*x - x^3*y^5 Q(x, y) = x^3*y^8 dP = diff(P, y) dQ = diff(Q, x) integral(integral(dQ - dP, y, -sqrt(4 - 4*x^2), sqrt(4 - 4*x^2)), x, -1, 1)
 7*pi 7*pi
var('t') r1 = vector([cos(t), 2*sin(t)]) parametric_plot(r1, (t, 0, 2*pi))
u, v = r1 du = diff(u, t) dv = diff(v, t) integral(P(u, v)*du + Q(u, v)*dv, t, 0, 2*pi)
 7*pi 7*pi

Exercise 2

A = vector([0, 0]) B = vector([1, 1]) C = vector([0, 1]) line([A, B, C, A])
var('x, y') F = vector([sqrt(x^2 + 1), arctan(x)]) P(x, y) = F[0] Q(x, y) = F[1] dP = diff(P, y) dQ = diff(Q, x) f = (dQ - dP).simplify_full() print "dQ/dx-dP/dy =", f integral(integral(f, y, x, 1), x, 0, 1)
 dQ/dx-dP/dy = 1/(x^2 + 1) 1/4*pi - 1/2*log(2) dQ/dx-dP/dy = 1/(x^2 + 1) 1/4*pi - 1/2*log(2)
var('t') r1 = (1 - t)*A + t*B dr1 = diff(r1, t) c1 = integral((F(x = r1[0], y = r1[1]).inner_product(dr1)).simplify_full(), t, 0, 1) print c1
 1/4*pi + 1/2*sqrt(2) + 1/2*arcsinh(1) - 1/2*log(2) 1/4*pi + 1/2*sqrt(2) + 1/2*arcsinh(1) - 1/2*log(2)
r2 = (1 - t)*B + t*C dr2 = diff(r2, t) c2 = integral((F(x = r2[0], y = r2[1]).inner_product(dr2)).simplify_full(), t, 0, 1) print c2
 -1/2*sqrt(2) - 1/2*arcsinh(1) -1/2*sqrt(2) - 1/2*arcsinh(1)
r3 = (1 - t)*C + t*A dr3 = diff(r3, t) c3 = integral((F(x = r3[0], y = r3[1]).inner_product(dr3)).simplify_full(), t, 0, 1) print c3
 0 0
expand(c1 + c2 + c3)
 1/4*pi - 1/2*log(2) 1/4*pi - 1/2*log(2)

15.5. Curl and Divergence

Ex. 1

var('x, y, z') def curl(F): # curl 함수를 정의 assert(len(F) == 3) # 3차원 벡터인지 확인 curl = vector([diff(F[2], y) - diff(F[1], z), diff(F[0], z) - diff(F[2], x), diff(F[1], x) - diff(F[0], y)]) return curl F = vector([x*z, x*y*z, -y^2]) print curl(F)
 (-x*y - 2*y, x, y*z) (-x*y - 2*y, x, y*z)

Ex. 3

F = vector([y^2*z^3, 2*x*y*z^3, 3*x*y^2*z^2]) print curl(F)
 (0, 0, 0) (0, 0, 0)

Ex. 4

var ('x, y, z') def divergence(F): # div 함수를 정의 assert(len(F) == 3) # 3차원 벡터인지 확인 return diff(F[0], x) + diff(F[1], y) + diff(F[2], z) F = vector([x*z, x*y*z, -y^2]) print divergence(F)
 x*z + z x*z + z

Exercise 1

var('x, y, z') def curl(F): # curl 함수를 정의 assert(len(F) == 3) # 3차원 벡터인지 확인 curl = vector([diff(F[2], y) - diff(F[1], z), diff(F[0], z) - diff(F[2], x), diff(F[1], x) - diff(F[0], y)]) return curl def divergence(F): # div 함수를 정의 assert(len(F) == 3) # 3차원 벡터인지 확인 return diff(F[0], x) + diff(F[1], y) + diff(F[2], z) F = vector([x^2*y*z, x*y^2*z, x*y*z^2]) print "curl F =", curl(F) print "div F =", divergence(F)
 curl F = (-x*y^2 + x*z^2, x^2*y - y*z^2, -x^2*z + y^2*z) div F = 6*x*y*z curl F = (-x*y^2 + x*z^2, x^2*y - y*z^2, -x^2*z + y^2*z) div F = 6*x*y*z

Exercise 2

F = vector([exp(x)*sin(y*z), z*exp(x)*cos(y*z), y*exp(x)*cos(y*z)]) print "curl F =", curl(F)
 curl F = (0, 0, 0) curl F = (0, 0, 0)
[P, Q, R] = F print "fx =", P print "fy =", Q print "fz =", R
 fx = e^x*sin(y*z) fy = z*cos(y*z)*e^x fz = y*cos(y*z)*e^x fx = e^x*sin(y*z) fy = z*cos(y*z)*e^x fz = y*cos(y*z)*e^x
# 적분할 때 적분상수 고려해야 함 f = integral(P, x) print f print diff(f, y) print diff(f, z)
 e^x*sin(y*z) z*cos(y*z)*e^x y*cos(y*z)*e^x e^x*sin(y*z) z*cos(y*z)*e^x y*cos(y*z)*e^x