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

## 1292 days ago by jhlee2chn

var('x, y, z') f(x, y) = log(x - 2*y) fx = diff(f, x) fy = diff(f, y) print z == f(3, 1) + fx(3, 1)*(x - 3) + fy(3, 1)*(y - 1) p1 = plot3d(f(x, y), (x, -1, 5), (y, -1, 3), opacity = 0.4) p2 = plot3d(f(3, 1) + fx(3, 1)*(x - 3) + fy(3, 1)*(y - 1), (x, -1, 5), (y, -1, 3), opacity = 0.4, color = 'red') p1 + p2
 z == x - 2*y - 1 z == x - 2*y - 1 Sleeping...
var('x, y, z') f(x, y) = 2*x^2 + y^2 fx = diff(f, x) fy = diff(f, y) print z == f(1, 1) + fx(1, 1)*(x - 1) + fy(1, 1)*(y - 1) p1 = plot3d(f(x, y), (x, -1, 3), (y, -1, 3), opacity = 0.4) p2 = plot3d(f(1, 1) + fx(1, 1)*(x - 1) + fy(1, 1)*(y - 1), (x, -1, 3), (y, -1, 3), opacity = 0.4, color = 'red') p1 + p2
 z == 4*x + 2*y - 3 z == 4*x + 2*y - 3 Sleeping...
var('x, y') f(x, y) = (1+y)/(1+x) fx = diff(f, x) fy = diff(f, y) L(x, y) = f(1, 3) + fx(1, 3)*(x - 1) + fy(1, 3)*(y - 3) print "L(x, y) =", L(x, y)
 L(x, y) = -x + 1/2*y + 3/2 L(x, y) = -x + 1/2*y + 3/2
var('x, y') f(x, y) = x*exp(x*y) fx = diff(f, x) fy = diff(f, y) L(x, y) = f(1, 0) + fx(1, 0)*(x - 1) + fy(1, 0)*(y - 0) print "L(x, y) =", L(x, y) print "f(1.1, -0.1) =", f(1.1, -0.1) print "L(1.1, -0.1) =", L(1.1, -0.1)
 L(x, y) = x + y f(1.1, -0.1) = 0.985417548826181 L(1.1, -0.1) = 1.00000000000000 L(x, y) = x + y f(1.1, -0.1) = 0.985417548826181 L(1.1, -0.1) = 1.00000000000000
var('t, u, v') f(u, v) = u^2*v + 3*u*v^4 x = sin(2*t) y = cos(t) print diff(f(x, y), t).subs(t = 0)
 6 6
var('x, y') f(x, y) = x^2 + 3*x*y - y^2 fx = diff(f, x) fy = diff(f, y) print fx print fy
 (x, y) |--> 2*x + 3*y (x, y) |--> 3*x - 2*y (x, y) |--> 2*x + 3*y (x, y) |--> 3*x - 2*y
print fx(2,3)*0.05+fy(2,3)*(-0.04) print f(2.05, 2.96)-f(2,3)
 0.650000000000000 0.644900000000002 0.650000000000000 0.644900000000002
var('r, h') V(r, h) = 1/3*pi*r^2*h Vr = diff(V, r) Vh = diff(V, h) print Vr print Vh
 (r, h) |--> 2/3*pi*h*r (r, h) |--> 1/3*pi*r^2 (r, h) |--> 2/3*pi*h*r (r, h) |--> 1/3*pi*r^2
V(10,25)
 2500/3*pi 2500/3*pi
print Vr(10, 25)*0.1+Vh(10, 25)*0.1
 20.0000000000000*pi 20.0000000000000*pi
var('t, u, v') f(u, v) = u^2*v + 3*u*v^4 x = sin(2*t) y = cos(t) print diff(f(x, y), t).subs(t = 0)
 6 6
var('s, t, u, v') f(u, v) = exp(u)*sin(v) x = s*t^2 y = s^2*t print diff(f(x, y), t) print diff(f(x, y), s)
 s^2*cos(s^2*t)*e^(s*t^2) + 2*s*t*e^(s*t^2)*sin(s^2*t) 2*s*t*cos(s^2*t)*e^(s*t^2) + t^2*e^(s*t^2)*sin(s^2*t) s^2*cos(s^2*t)*e^(s*t^2) + 2*s*t*e^(s*t^2)*sin(s^2*t) 2*s*t*cos(s^2*t)*e^(s*t^2) + t^2*e^(s*t^2)*sin(s^2*t)
var('s, t, u, v') f(u, v, w) = u^4*v + v^2*w^3 x = r*s*exp(t) y = r*s^2*exp(-t) z = r^2*s*sin(t) print diff(f(x, y, z), s).subs(r=2, s=1, t=0)
 192 192
var('s, t, u, v') x = s^2 - t^2 y = t^2 - s^2 g = function('g')(u, v) print diff(g(u = x, v = y), s) print diff(g(u = x, v = y), t) print t*diff(g(u = x, v = y), s) + s*diff(g(u = x, v = y), t) print expand(t*diff(g(u = x, v = y), s) + s*diff(g(u = x, v = y), t))
 2*s*D[0](g)(s^2 - t^2, -s^2 + t^2) - 2*s*D[1](g)(s^2 - t^2, -s^2 + t^2) -2*t*D[0](g)(s^2 - t^2, -s^2 + t^2) + 2*t*D[1](g)(s^2 - t^2, -s^2 + t^2) -2*(t*D[0](g)(s^2 - t^2, -s^2 + t^2) - t*D[1](g)(s^2 - t^2, -s^2 + t^2))*s + 2*(s*D[0](g)(s^2 - t^2, -s^2 + t^2) - s*D[1](g)(s^2 - t^2, -s^2 + t^2))*t 0 2*s*D[0](g)(s^2 - t^2, -s^2 + t^2) - 2*s*D[1](g)(s^2 - t^2, -s^2 + t^2) -2*t*D[0](g)(s^2 - t^2, -s^2 + t^2) + 2*t*D[1](g)(s^2 - t^2, -s^2 + t^2) -2*(t*D[0](g)(s^2 - t^2, -s^2 + t^2) - t*D[1](g)(s^2 - t^2, -s^2 + t^2))*s + 2*(s*D[0](g)(s^2 - t^2, -s^2 + t^2) - s*D[1](g)(s^2 - t^2, -s^2 + t^2))*t 0
var('r, s, u, v') x = r^2 + s^2 y = 2*r*s f = function('f')(u, v) print diff(f(u = x, v = y), r) print expand(diff(f(u = x, v = y), r, 2))
 2*r*D[0](f)(r^2 + s^2, 2*r*s) + 2*s*D[1](f)(r^2 + s^2, 2*r*s) 4*r^2*D[0, 0](f)(r^2 + s^2, 2*r*s) + 8*r*s*D[0, 1](f)(r^2 + s^2, 2*r*s) + 4*s^2*D[1, 1](f)(r^2 + s^2, 2*r*s) + 2*D[0](f)(r^2 + s^2, 2*r*s) 2*r*D[0](f)(r^2 + s^2, 2*r*s) + 2*s*D[1](f)(r^2 + s^2, 2*r*s) 4*r^2*D[0, 0](f)(r^2 + s^2, 2*r*s) + 8*r*s*D[0, 1](f)(r^2 + s^2, 2*r*s) + 4*s^2*D[1, 1](f)(r^2 + s^2, 2*r*s) + 2*D[0](f)(r^2 + s^2, 2*r*s)
var('x, y') F(x, y) = x^3 + y^3 - 6*x*y Fx = diff(F(x, y), x) Fy = diff(F(x, y), y) print -Fx/Fy
 -(x^2 - 2*y)/(y^2 - 2*x) -(x^2 - 2*y)/(y^2 - 2*x)
var('x, y, z') F(x, y, z) = x^3 + y^3 + z^3 + 6*x*y*z - 1 Fx = diff(F(x, y, z), x) Fy = diff(F(x, y, z), y) Fz = diff(F(x, y, z), z) print -Fx/Fz print -Fy/Fz
 -(x^2 + 2*y*z)/(2*x*y + z^2) -(y^2 + 2*x*z)/(2*x*y + z^2) -(x^2 + 2*y*z)/(2*x*y + z^2) -(y^2 + 2*x*z)/(2*x*y + z^2)
var('x, y') a = vector([cos(pi/6), sin(pi/6)]) u = a / a.norm() f(x, y) = x^3 - 3*x*y + 4*y^2 gradf = f.gradient() print u.inner_product(gradf(x,y))
 3/2*sqrt(3)*(x^2 - y) - 3/2*x + 4*y 3/2*sqrt(3)*(x^2 - y) - 3/2*x + 4*y
f(x, y) = x^2*y^3 - 4*y a = vector([2, 5]) u = a / a.norm() gradf = f.gradient() print u.inner_product(gradf(2, -1))
 32/29*sqrt(29) 32/29*sqrt(29)
f(x, y, z) = x*sin(y*z) a = vector([1, 2, -1]) u = a / a.norm() gradf = f.gradient() print u.inner_product(gradf(1, 3, 0))
 -1/2*sqrt(6) -1/2*sqrt(6)
var('x, y, z') T = vector([x, y, z]) f(x, y, z) = x^2/4 + y^2 + z^2/9 - 3 P = vector([-2, 1, -3]) gradf = f.gradient() print gradf(P[0], P[1], P[2]).inner_product(T-P)==0 print gradf(P[0], P[1], P[2])
 -x + 2*y - 2/3*z - 6 == 0 (-1, 2, -2/3) -x + 2*y - 2/3*z - 6 == 0 (-1, 2, -2/3)
f(x, y, z) = x*y^2*arctan(z) v = vector([1, 1, 1]) u = v / v.norm() gradf = f.gradient() print u.inner_product(gradf(2, 1, 1))
 5/12*sqrt(3)*pi + 1/3*sqrt(3) 5/12*sqrt(3)*pi + 1/3*sqrt(3)
var('x, y, z') T = vector([x, y, z]) f(x, y, z) = x*y + y*z + z*x -5 P = vector([1, 2, 1]) gradf = f.gradient() print gradf(P[0], P[1], P[2]).inner_product(T-P)==0 print gradf(P[0], P[1], P[2])
 3*x + 2*y + 3*z - 10 == 0 (3, 2, 3) 3*x + 2*y + 3*z - 10 == 0 (3, 2, 3)