0% found this document useful (0 votes)
9 views4 pages

Sis 5

The document contains a series of MATLAB code snippets that calculate the derivative of various mathematical expressions with respect to a variable 't' or 'x', 'y', 'z'. Each snippet evaluates the derivative at specific points and prints the results. The derivatives involve trigonometric, logarithmic, and exponential functions, as well as implicit differentiation for multivariable equations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

Sis 5

The document contains a series of MATLAB code snippets that calculate the derivative of various mathematical expressions with respect to a variable 't' or 'x', 'y', 'z'. Each snippet evaluates the derivative at specific points and prints the results. The derivatives involve trigonometric, logarithmic, and exponential functions, as well as implicit differentiation for multivariable equations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

%3

syms t

x = (cos(t))^2;
y = (sin(t))^2;
z = 1/t;
w = (x/z) + (y/z);

dw_dt = diff(w, t);

t_value = 3;
dw_dt_at_t3 = subs(dw_dt, t, t_value);

fprintf('dw/dt at t = 3 is: %.4f\n', dw_dt_at_t3);

dw/dt at t = 3 is: 1.0000


%4
syms t;

x = cos(t);
y = sin(t);
z = 4 * sqrt(t);
w = log(x^2 + y^2 + z^2);

dw_dt = diff(w, t);

t_value = 3;
dw_dt_at_t3 = subs(dw_dt, t, t_value);

fprintf('dw/dt at t = 3 is: %.4f\n', dw_dt_at_t3);

dw/dt at t = 3 is: 0.3265


%5
syms t;

x = log(t^2 + 1);
y = atan(t);
z = exp(t);
w = 2*y*exp(x) - log(z);

dw_dt = diff(w, t);

t_value = 1;
dw_dt_at_t1 = subs(dw_dt, t, t_value);

fprintf('dw/dt at t = 1 is: %.4f\n', dw_dt_at_t1);


dw/dt at t = 1 is: 4.1416
%6
syms t;

x = t;
y = log(t);
z = exp(t-1);
w = z - sin(x*y);

dw_dt = diff(w, t);

t_value = 1;
dw_dt_at_t1 = subs(dw_dt, t, t_value);

fprintf('dw/dt at t = 1 is: %.4f\n', dw_dt_at_t1);


dw/dt at t = 1 is: 0.0000
%25
syms x y;
equation = x^3 - 2*y^2 + x*y;

dy_dx = -diff(equation, x) / diff(equation, y);

x_value = 1;
y_value = 1;
dy_dx_at_point = subs(dy_dx, [x, y], [x_value, y_value]);

disp(dy_dx_at_point);
4/3
%26
syms x y;

equation = x*y + y^2 - 3*x -3;

dy_dx = -diff(equation, x) / diff(equation, y);

x_value = -1;
y_value = 1;
dy_dx_at_point = subs(dy_dx, [x, y], [x_value, y_value]);

disp(dy_dx_at_point);
2
%27
syms x y;

equation = x^2 + y^2 + x*y - 7;

dy_dx = -diff(equation, x) / diff(equation, y);

x_value = 1;
y_value = 2;
dy_dx_at_point = subs(dy_dx, [x, y], [x_value, y_value]);

disp(dy_dx_at_point);
-4/5
%28
syms x y;

equation = x*exp(y) - sin(x*y) + y - log(2);

dy_dx = -diff(equation, x) / diff(equation, y);

x_value = 0;
y_value = log(2);
dy_dx_at_point = subs(dy_dx, [x, y], [x_value, y_value]);

disp(dy_dx_at_point);
6243314768165359/9007199254740992 - exp(6243314768165359/9007199254740992)
%29
syms x y z;
equation = z^3 + y^3 - x*y + y*z - 2;

dz_dx = -diff(equation, x) / diff(equation, z);


dz_dy = -diff(equation, y) / diff(equation, z);

x_value = 1;
y_value = 1;
z_value = 1;

dz_dx_at_point = subs(dz_dx, [x, y, z], [x_value, y_value, z_value]);


dz_dy_at_point = subs(dz_dy, [x, y, z], [x_value, y_value, z_value]);

disp(dz_dx_at_point);
disp(dz_dy_at_point);
1/4

-3/4
%30
syms x y z;

equation = (1/x) + (1/y) + (1/z) - 1;

dz_dx = -diff(equation, x) / diff(equation, z);


dz_dy = -diff(equation, y) / diff(equation, z);

x_value = 2;
y_value = 3;
z_value = 6;

dz_dx_at_point = subs(dz_dx, [x, y, z], [x_value, y_value, z_value]);


dz_dy_at_point = subs(dz_dy, [x, y, z], [x_value, y_value, z_value]);

disp(dz_dx_at_point);
disp(dz_dy_at_point);
-9

-4
%31
syms x y z;

equation = sin(x+y) + sin(y+z) + sin(x+z);

dz_dx = -diff(equation, x) / diff(equation, z);


dz_dy = -diff(equation, y) / diff(equation, z);

x_value = pi;
y_value = pi;
z_value = pi;

dz_dx_at_point = subs(dz_dx, [x, y, z], [x_value, y_value, z_value]);


dz_dy_at_point = subs(dz_dy, [x, y, z], [x_value, y_value, z_value]);

disp(dz_dx_at_point);
disp(dz_dy_at_point);
-1
-1
%32
syms x y z;

equation = x*exp(y) + y*exp(z) + 2*log(x) - 2 - 3*log(2);

dz_dx = -diff(equation, x) / diff(equation, z);


dz_dy = -diff(equation, y) / diff(equation, z);

x_value = 1;
y_value = log(2);
z_value = log(3);

dz_dx_at_point = subs(dz_dx, [x, y, z], [x_value, y_value, z_value]);


dz_dy_at_point = subs(dz_dy, [x, y, z], [x_value, y_value, z_value]);

disp(dz_dx_at_point);
disp(dz_dy_at_point);
-
(9007199254740992*exp(-2473854946935173/2251799813685248)*(exp(6243314768165359/
9007199254740992) + 2))/6243314768165359

-
(9007199254740992*exp(-2473854946935173/2251799813685248)*(exp(6243314768165359/
9007199254740992) + exp(2473854946935173/2251799813685248)))/6243314768165359

You might also like