Lab 3
Lab 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Example
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Example
Example
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Example
f:2*x*y-3*x^2*y;
fx:diff(f,x);
fy:diff(f,y);
/* given xt=dx/dt=3 and ft=df/dt=0, at x=3 and y=1*/
flowrate:ft=fx*xt+fy*yt;
val:solve(flowrate,yt);
ans:ev(val,x=3,y=1,xt=3,ft=0);
print("The value of y shall decrease at a rate of ", abs(ans), "per second")$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Jacobian
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
f1u:diff(f1,u);
f1v:diff(f1,v);
f1w:diff(f1,w);
f2u:diff(f2,u);
f2v:diff(f2,v);
f2w:diff(f2,w);
f3u:diff(f3,u);
f3v:diff(f3,v);
f3w:diff(f3,w);
f1x:diff(f1,x);
f1y:diff(f1,y);
f1z:diff(f1,z);
f2x:diff(f2,x);
f2y:diff(f2,y);
f2z:diff(f2,z);
f3x:diff(f3,x);
f3y:diff(f3,y);
f3z:diff(f3,z);
J1:matrix([f1u,f1v,f1w],[f2u,f2v,f2w],[f3u,f3v,f3w]);
J2:matrix([f1x,f1y,f1z], [f2x,f2y,f2z],[f3x,f3y,f3z]);
JA1:determinant(J1);
JA2:determinant(J2);
JA:(-1)^(3)*(JA1/JA1);
print("The jacobian of",f1,"=0",f2,"=0", "and",f3,"=0","is equal to",JA)$
print("Therefore", if(JA=0) then "the functions u,v,w are dependent" else "the
functions u,v,w are independent")$
%%%%%%%%%%%%% OR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
Aliternate method