> # sfb 7 Mar, 2002 > restart: > with(plots);with(plottools);with(linalg); > x=r*cos(theta);y=r*sin(theta);coordplot(polar,color=[red,black],scaling=constrained); > a:=polarplot(1+cos(theta),theta=0..2*Pi,scaling=constrained,color=blue):a; > b:=plot({x,x/sqrt(3)},x=-0.5..2,color=green):b; > c:=polarplot({1, 1.2},theta=0..2*Pi,color=green):c; > display(a,b,c); > # dA = dx dy = r dr dtheta > > time(int(int(1,y=-sqrt(1-x^2)..sqrt(1-x^2)),x=-1..1)); > time(int(int(1*r,r=0..1),theta=0..2*Pi)); > time(int(int(sqrt(1-x^2-y^2),y=-sqrt(1-x^2)..sqrt(1-x^2)),x=-1..1)); > time(int(int(sqrt(1-r^2)*r,r=0..1),theta=0..2*Pi)); > # cylindrical coordinates (r, theta, z) [Polar with z] > x=r*cos(theta);y=r*sin(theta);z=z;coordplot3d(cylindrical); > # cylinderplot assume r = r(theta,z); > # dV = dx dy dz = r dr dtheta dz > cylinderplot(1+z*sin(theta),theta=0..2*Pi,z=0..2); > cylinderplot(2,theta=0..2*Pi,z=0..2); > coordplot3d(spherical); > sphereplot(2,theta=0..2*Pi,phi=0..Pi); > a:=sphereplot(2,theta=0..2*Pi,phi=0..Pi/4,scaling=constrained):a; > b:=cylinderplot(z,theta=0..2*Pi,z=0..sqrt(2)):b; > display(a,b); > #dV = rho^2 sin (phi) d pho d phi d theta > 'int(int(int(rho^2*sin(phi),rho=0..1),phi=0..Pi),theta=0..2*Pi)'=int(int(int(rho^2*sin(phi),rho=0..1),phi=0..Pi),theta=0..2*Pi); > 'int(int(int(1*r,z=-sqrt(1-r^2)..sqrt(1-r^2)),r=0..1),theta=0..2*Pi)'=int(int(int(1*r,z=-sqrt(1-r^2)..sqrt(1-r^2)),r=0..1),theta=0..2*Pi); > 'int(int(int(1,z=-sqrt(1-x^2-y^2)..sqrt(1-x^2-y^2)),y=-sqrt(1-x^2)..sqrt(1-x^2)),x=-1..1)'=int(int(int(1,z=-sqrt(1-x^2-y^2)..sqrt(1-x^2-y^2)),y=-sqrt(1-x^2)..sqrt(1-x^2)),x=-1..1); > x=rho*sin(phi)*cos(theta);y=rho*sin(phi)*sin(theta);z=rho*cos(phi);r=rho*sin(phi); > #1. normal dot (X - X_0) > F:=x+y^2+z^3+x*y*z; > gF:=grad(F,[x,y,z]); > gfp:=eval([gF[1],gF[2],gF[3]],{x=3,y=2,z=1}); > xmx0:=vector([x-3,y-2,z-1]); > dotprod(gfp,xmx0,orthogonal)=0; > #2 directional derivative > F:=sin(x)*cos(y)*ln(z); > gF:=grad(F,[x,y,z]); > gfp:=eval([gF[1],gF[2],gF[3]],{x=Pi/4,y=Pi/3,z=3}); > u:=vector([4/6,-4/6,2/6]); > dotprod(gfp,xmx0,orthogonal); > Z:=(x+y)*ln(x+y);diff(Z,x);diff(Z,y); > X:=u*sin(v);Y:=u^2+v^(-2);diff(X,u);diff(X,v);diff(Y,u);diff(Y,v); > Z_u:=diff(Z,x)*diff(X,u)+diff(Z,y)*diff(Y,u); > Z_v:=diff(Z,x)*diff(X,v)+diff(Z,y)*diff(Y,v); > r:=[t*cos(2*Pi*t),t*sin(2*Pi*t)]; > diff(r,t); > diff(r,t,t); > plot([t*cos(2*Pi*t),t*sin(2*Pi*t),t=0..2],x=-2..2); > > int(sqrt(diff(r[1],t)^2+diff(r[2],t)^2),t=0..2); > evalf(int(sqrt(diff(r[1],t)^2+diff(r[2],t)^2),t=0..2)); > #8 > F:=x+2*y-lambda*(x^2+4*y^2-1); > diff(F,x)=0;diff(F,y)=0;diff(F,lambda)=0;; > #5 > f:=8*x*y-(x+y)^4/4; > diff(f,x)=0;diff(f,y)=0; > diff(f,x,x);diff(f,x,y);diff(f,y,y); > f:=int(x*(x-1),x); > plot(f,x=-1..2); > g:=int((x-3)*(x-4)*(x-5),x); > plot(g,x=2..6); > plot3d(f+subs(x=y,g),x=-1..2,y=2..6); >