MA1104 Laboratory 3 Command lines. 1. restart:with(plots):with(linalg): g:=(x,y)->(abs(x^2-y^2))/(x^2+y^2); limit(g(x,0),x=0); limit(g(0,y),y=0); t:=Pi/3; curve:=spacecurve([s*cos(t),s*sin(t),g(s*cos(t),s*sin(t))],s=-0.05..0.05,thickness=3,color=black,orientation=[10,20]): graph11:=plot3d(g(x,y),x=-0.05..0.05,y=-0.05..0.05,style=patchnogrid): display(graph11,curve); limit((g(s*cos(t),s*sin(t))),s=0); t:='t'; limit(g(s*cos(t),s*sin(t)),s=0);simplify(%); graph12:=animate3d([x,x*tan(t),g(x,x*tan(t))],x=-0.01..0.01,y=0..0.04,t=0..2*Pi,thickness=3):display(graph11,graph12); 2. restart:with(plots):with(linalg): m:=3: r1:=t->t:r2:=t->m*t:r:=[r1,r2]; f:=(x,y)->(x-1)^2+3*(y-1)^2+5; graph21:=plot3d(f(x,y),x=-1..3,y=-1..3,style=patchnogrid,axes=frame): graph22:=spacecurve([r1(t),r2(t),f(op(r(t)))],t=-0.3..0.5,thickness=3,color=black,orientation=[-30,40]): graph23:=spacecurve([r1(t),r2(t),0],t=0..0.5,thickness=3,color=red): graph24:=plot3d([x,m*x,y],x=0..1.6,y=0..20,style=patchnogrid,thickness=3,color=blue): display(graph21,graph22,graph23,graph24); u:=evalm([1,m]/norm([1,m],2)); limit((f(0+u[1]*h,0+u[2]*h)-f(0,0))/h,h=0); grad(f(x,y), vector([x,y])); gradient:=subs(x=0,y=0,%); dotprod(gradient,u); slope:=dotprod(gradient,u); graph25:=spacecurve(evalm([0,0,f(0,0)]+t*[u[1],u[2],slope]),t=-1..1,thickness=3,color=green,orientation=[-30,40]): display(graph21,graph22,graph23,graph24,graph25); 3. restart:with(plots):with(plottools):with(linalg): g:=(x,y)->x^2 + 3*y^2 +2*x*y; contour:=contourplot(g(x,y),x=-16..16,y=-12..12,filled=true,coloring=[white,blue],axes=none): display(contour); levelc:=implicitplot(g(x,y)=150,x=-15..15,y=-10..10,thickness=3): display(contour,levelc); grad(g(x,y), vector([x,y])); n:=subs(x=5,y=5,%);u:=evalm(n/norm(n,2)); v:=arrow([5,5],u,0.02,0.1,0.1): display(contour,levelc,v); display(contourplot(g(x,y),x=4..6,y=4..6,filled=true, coloring= [white,blue],axes=none), implicitplot(g(x,y)=150,x=4..6,y=4..6, thickness=3),v,scaling=constrained); implicitdiff(g(x,y),y,x); derivative:=subs(x=5,y=5,%); simplify(derivative*(n[2]/n[1])); plot3d(g(x,y),x=-5..5,y=-5..5); contourplot3d(sqrt(z/((cos(theta))^2+3*(sin(theta))^2+2*cos(theta)*sin(theta))),theta=0..2*Pi,z=0..10,coords=cylindrical,numpoints=3000);