matlab
matlab
Q Find the Directional derivative of x*y + y*z + z*x at (1, 2, 0) in the direction of 1, 2, 2.
syms x y z;
theta = x*y + y*z + z*x;
point = [1, 2, 0];
direction = [1, 2, 2];
grad_theta = gradient(theta, [x, y, z]);
grad_theta_at_point = subs(grad_theta, [x, y, z], point);
direction_unit = direction / norm(direction);
D_theta = dot(grad_theta_at_point, direction_unit);
fprintf('Directional derivative for Problem 1: %f\n', double(D_theta));
output
Directional derivative for Problem 1: 3.333333
ASSIGNMENT
Q Find the Directional derivative 2*x^2 + 3*y^2 + z^2 at (2, 1, 3) in the direction of 1, 0, -2.
syms x y z;
f = 2*x^2 + 3*y^2 + z^2;
point = [2, 1, 3];
direction = [1, 0, -2];
grad_f = gradient(f, [x, y, z]);
grad_f_at_point = subs(grad_f, [x, y, z], point);
direction_unit = direction / norm(direction);
D_f = dot(grad_f_at_point, direction_unit);
fprintf('Directional derivative for Problem 3: %f\n', double(D_f));
output
Directional derivative for Problem 3: -1.788854
ASSIGNMENT
Q Find the Directional derivative 2*x^2 + 3*y^2 + z^2 at (2, 1, 3) in the direction of 1, 0, -2.