0% found this document useful (0 votes)
2 views

Lab3 (1)

The document outlines a laboratory experiment focused on calculating partial derivatives and the Jacobian using both manual methods and built-in functions in MATLAB. It includes formulas for differentiation, commands for MATLAB, and a series of activities and assignments to practice finding partial derivatives and Jacobians for various functions. The document also emphasizes the importance of mixed derivatives and provides examples of calculations and visualizations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lab3 (1)

The document outlines a laboratory experiment focused on calculating partial derivatives and the Jacobian using both manual methods and built-in functions in MATLAB. It includes formulas for differentiation, commands for MATLAB, and a series of activities and assignments to practice finding partial derivatives and Jacobians for various functions. The document also emphasizes the importance of mixed derivatives and provides examples of calculations and visualizations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Laboratory-3 experiments

PARTIAL DERIVATIVES AND JACOBIAN

Aim: To find i) the partial derivatives


ii) Jacobian using the partial derivatives
iii) Jacobian using the built-in function
iv) Visualization of Jacobian.
.

Formulae:
f
1)  Differentiate f w.r.t x by treating all other independent variables as constant
x
𝜕𝑢 𝜕𝑢
𝜕(𝑢,𝑣) 𝜕𝑥 𝜕𝑦
2) Jacobian of (u,v) w.r.t (x,y) is 𝐽 = 𝜕(𝑥,𝑦) = [𝜕𝑣 𝜕𝑣
]
𝜕𝑥 𝜕𝑦

 f
2
 f2
Note : 1) and are called mixed derivatives and are equal.
x y y x
2) Jacobian is a consequence of geometric distortion due to transformation

Matlab commands: diff, simplify, disp, if, fimplicit3, jacobian

diff - computes the derivative

Df = diff(f,var,n) computes the nth partial derivative of f with respect to var.

simplify - Algebraic simplification

S = simplify(expr) performs algebraic simplification of expr.

If expr is a symbolic vector or matrix, this function simplifies each element of expr

disp - Display array

disp(X) displays array X

If X is a string or character array, the text is displayed

if - Conditionally execute statements

if expression
statements
ELSEIF expression
statements
ELSE
statements
END
fimplicit3 Plot implicit surface

fimplicit3(FUN) plots the surface where FUN(X,Y,Z)==0 between the axes limits,
with a default range of [-5 5].

jacobian Jacobian matrix.

jacobian(f,x) computes the Jacobian of the scalar or vector f with respect to the vector x.

Activities

1. Find all possible partial derivatives up to second order for the function f(x,y)=xy
2. Find all possible partial derivatives up to second order for f(x,y,z)=xyz
3. If then show that .

4. If then show that

5. If u=log(tanx+tany+tanz) then show that

6. If then show that

7. Find the Jacobian of and


8. Find the Jacobian of and
9. Find the Jacobian of and
10. Find the Jacobian of , and

Assignment
Compute the Jacobian using built-in function and vice versa for the problem Nos.7 to 10.
Find all possible partial derivatives up to second order for the function f(x,y)=xy

clear
syms x y f
f=x*y
dfx=diff(f)
dfy=diff(f,y)
dfxx=diff(f,2) % dfxx=diff(diff(f),x)
dfxy=diff(dfx,y)
dfyx=diff(dfy,x)
dfyy=diff(dfy,y)

f = dfx = y dfy = x dfxx = 0 dfxy = 1


dfyx = 1 dfyy = 0

Find all possible partial derivatives up to second order for f(x,y,z)=xyz

clear
syms x y z f(x,y,z)
f=x*y*z
dfx=diff(f)
dfy=diff(f,y)
dfz=diff(f,z)
dfxx=diff(f,2) % dfxx=diff(diff(f),x)
dfxy=diff(dfx,y)
dfxz=diff(dfx,z)
dfyx=diff(dfy,x)
dfyy=diff(dfy,y)
dfyz=diff(dfy,z)
dfzx=diff(dfz,x)
dfzy=diff(dfz,y)
dfzz=diff(dfz,z)

f = dfx = dfy = dfz =


dfxx = 0 dfxy = z dfxz = y dfyx = z
dfyy = 0 dfyz = x dfzx = y dfzy = x
dfzz = 0
If then show that

clear
syms x y u
u=x^2*atan(y/x)-y^2*atan(x/y)
dux=diff(u);
dfxyL=diff(dux,y);
dfxy=simplify(dfxyL)

u =

dfxy =

If then show that

clear
syms x y u
u=x^y
dux=diff(u);
dfxy=diff(dux,y);
dfxyL=simplify(dfxy)
duy=diff(u,y);
dfyx=diff(duy,x);
dfxyR=simplify(dfyx)
if (dfxyL==dfxyR)
disp('Mixed Derivatives are Equal')
end

u =
dfxyL = dfxyR =

Mixed Derivatives are Equal


If u=log(tanx+tany+tanz) then show that

clear
syms x y z u
u=log(tan(x)+tan(y)+tan(z))
ux=diff(u,x)
uy=diff(u,y)
uz=diff(u,z)
LHS=sin(2*x)*ux+sin(2*y)*uy+sin(2*z)*uz
simplify(LHS)

u =
ux = uy = uz =

LHS =

ans =2

If then show that

clear
syms x y Z
Z=(x^2+y^2)/(x+y)
ux=diff(Z)
uy=diff(Z,y)
LHS=(ux-uy)^2
RHS=4*(1-ux-uy)
LHS1=simplify(LHS)
RHS1=simplify(RHS)
if (LHS1==RHS1)
disp('Given relation is true')
end

Z =

ux = uy =

LHS = RHS =

LHS1 = RHS1 =

Given relation is true


Find the Jacobian of and

syms x y r th
x=r*cos(th);
y=r*sin(th);
J=[diff(x,r) diff(x,th);diff(y,r) diff(y,th)];
J1=simplify(det(J));
fimplicit3(x)
fimplicit3(y)
fimplicit3(J)

J1 = r
Find the Jacobian of and

clear
syms x y u v
u=x*sin(y);
v=y*sin(x);
J=[diff(u,x) diff(u,y);diff(v,x) diff(v,y)];
J1=simplify(det(J))
fimplicit3(x)
fimplicit3(y)
fimplicit3(J)

J1 =
Find the Jacobian of and

clear
syms x y u v
x=u^2-v^2;
y=2*u*v;
J=[diff(x,u) diff(x,v);diff(y,u) diff(y,v)];
J1=simplify(det(J))
fimplicit3(x)
fimplicit3(y)
fimplicit3(J)

J1 =
Find the Jacobian of , and

clear
syms x y z u v w
u=5*y;
v=4*x^2-2*sin(y*z);
w=y*z;
fimplicit3(u)
fimplicit3(v)
fimplicit3(w)
J=jacobian([u;v;w],[x y z])
fimplicit3(J)

J =

You might also like