MATH 251: Calculus 3, SET8
14: Partial Derivatives
14.5: The Chain Rule
These problems are done with the CAS. See Hand Solutions for details.
We compute a derivative using the Chain Rule (intermediate pieces) then check our work directly (all at once with independent variable).
z = sqrt(1 + x*y), g = [tan(t) atan(t)] % g = [x y] in terms of t
grad_z = gradient(z, [x y]), Dg = diff(g,t)
dz_dt = dot(grad_z, Dg) % mixed (chaining variables x and y plus independent variable t)
dz_dt = subs(dz_dt, [x y], g) % solely in terms of t
Again, the Chain Rule allows us to break the problem into smaller simpler pieces, then aggregate results.
w = log(sqrt(x^2 + y^2 + z^2))
g = [sin(t) cos(t) tan(t)], % g = [x y z] in terms of t
grad_w = gradient(w, [x y z]), Dg = diff(g,t)
dw_dt = dot(grad_w, Dg) % mixed (chaining variables x,y,z plus independent variable t)
dw_dt = simplify(subs(dw_dt, [x y z], g)) % solely in terms of t
dW_dt = simplify(diff(W,t))
Here we'll just use the Chain Rule and leave the results in terms of mixed variables.
z = atan(x^2 + y^2), g = [s*log(t) t*exp(s)] % g = [x y] in terms of s and t
grad_z = gradient(z, [x y]), gs = diff(g,s), gt = diff(g,t) % partial derivatives
zs = dot(grad_z, gs) % mixed
zt = dot(grad_z, gt) % mixed
In this problem we are given a table instead of formulas. See Hand Solutions for the solution written in steps using table values.
Here we'll use the Chain Rule with mixed variables then substitute values for these to obtain numerical partial derivative values.
T = v / (2*u + v), g = [p*q*sqrt(r) p*sqrt(q)*r] % g = [u v] in terms of p, q, r
grad_T = simplify(gradient(T, [u v])), gp = diff(g,p), gq = diff(g,q), gr = diff(g,r)
Tp = simplify(dot(grad_T, gp)), Tq = simplify(dot(grad_T, gq)), Tr = simplify(dot(grad_T, gr))
uv_num = subs(g, [p q r], [2 1 4])
Tp_num = subs(Tp, [p q r u v], [2 1 4 4 8])
Tq_num = subs(Tq, [p q r u v], [2 1 4 4 8])
Tr_num = subs(Tr, [p q r u v], [2 1 4 4 8])
We proceed the same way as in #5.
P = sqrt(u^2 + v^2 + w^2), g = [x*exp(y) y*exp(x) exp(x*y)] % g = [u v w] in terms of x, y
grad_P = gradient(P, [u v w]), gx = diff(g,x), gy = diff(g,y)
Px = dot(grad_P, gx), Py = dot(grad_P, gy)
uvw_num = subs(g, [x y], [0 2])
Px_num = subs(Px, [u v w x y], [0 2 1 0 2])
Py_num = subs(Py, [u v w x y], [0 2 1 0 2])
Here we use the method given on page 943 of the textbook to do implicit differentiation.
F = x^2 - y^2 + z^2 - 2*z - 4 % Let F = LHS - RHS of the equation given, understood to be set 0.
zx = simplify( -diff(F,x) / diff(F,z) )
zy = simplify( -diff(F,y) / diff(F,z) )
We use the Chain Rule to compute a rate of change of volume of a cone w.r.t. time.
V = 1/3 * pi * r^2 * h, g = [h r]
grad_V = gradient(V, [h r]), Dg = [Dh Dr] % dg/dt = [dh/dt dr/dt]
dV_dt_num = subs(dV_dt, [Dh Dr h r], [-2.5 1.8 140 120])
dV_dt_num_appx = double(dV_dt_num) % in cm^3 / s
We use the Chain Rule to compute a rate of change of production, an economics problem.
P = 1.47 * L^0.65 * K^0.35, g = [K L]
grad_P = gradient(P, [K L]), Dg = [DK DL] % dg/dt = [dK/dt dL/dt]
dP_dt = dot(grad_P, Dg) % Ignore complex conjugation: the variables are real!
dP_dt_num = subs(dP_dt, [DK DL K L], [1/2 -2 8 30])
dP_dt_num_appx = double(dP_dt_num) % in millions of dollars per year
% So production is decreasing at $596,000 per year.
An equation involving partial derivatives is verified.
syms g s t u u_x u_y x y real
g = exp(s)*[cos(t) sin(t)] % g = [x y] in terms of s and t
grad_u = [u_x u_y], g_s = diff(g,s), g_t = diff(g,t)
u_s = simplify(dot(grad_u, g_s)), u_t = simplify(dot(grad_u, g_t))
RHS = simplify( exp(-2*s) * (u_s^2 + u_t^2) )
verily = simplify( LHS == RHS )