> # Section 11.1\ # Selected exercises -- some don't translate well to Maple > # exercise 3\ # the next command asks for help on the pointplot command, ?plots gives the list of plot commands\ ?pointplot\ # how to load the collection of plot commands \ with(plots):\ # plot the corners\ pointplot({[1,1,2],[3,4,5],[1,1,5],[1,4,2],[3,1,2],[1,4,5],[3,1,5],[3,4,2]},axes=normal,color=yellow); -------------------------------------------------------------------------------- > # exercise 5\ # define a distance function\ dist := a -> sqrt(a[1]*a[1]+a[2]*a[2]+a[3]*a[3]); 2 2 2 dist := a -> sqrt(a[1] + a[2] + a[3] ) -------------------------------------------------------------------------------- > A:=[-2,6,1];B:=[3,3,2]; C:=[1,4,4]; A := [-2, 6, 1] B := [3, 3, 2] C := [1, 4, 4] -------------------------------------------------------------------------------- > # need some vector stuff, load with the command\ with(linalg):\ > dist(add(A,B,1,-1));\ 1/2 35 -------------------------------------------------------------------------------- > dist(add(A,C,1,-1)); 1/2 22 -------------------------------------------------------------------------------- > dist(add(B,C,1,-1)); 3 -------------------------------------------------------------------------------- > # and since 9 + 22 != 35 this is an un-interesting triangle.\ # note the build in norm ( vector, 2) function is our distance function\ norm(add(A,B,1,-1),2); 1/2 35 -------------------------------------------------------------------------------- > # Exercise 15\ eq1 := x^2 + y^2 + z^2 + 2*x + 8*y-4*z = 28; 2 2 2 eq1 := x + y + z + 2 x + 8 y - 4 z = 28 -------------------------------------------------------------------------------- > eq2 := (x-h)^2+(y-k)^2+(z-l)^2=r^2; 2 2 2 2 eq2 := (x - h) + (y - k) + (z - l) = r -------------------------------------------------------------------------------- > eq3:=expand(eq2); 2 2 2 2 2 2 2 eq3 := x - 2 x h + h + y - 2 y k + k + z - 2 z l + l = r -------------------------------------------------------------------------------- > solve({coeff(lhs(eq1),x,1)=coeff(lhs(eq3),x,1),coeff(lhs(eq1),y,1)=coeff(lhs(eq3),y,1),\ coeff(lhs(eq1),z,1)=coeff(lhs(eq3),z,1)},{h,k,l}); {h = -1, k = -4, l = 2} -------------------------------------------------------------------------------- > coeff(coeff(coeff(lhs(eq3),x,0),y,0),z,0); 2 2 2 h + k + l -------------------------------------------------------------------------------- > # an easier way uses the student package\ with(student); [D, Doubleint, Int, Limit, Lineint, Sum, Tripleint, changevar, combine, completesquare, distance, equate, extrema, integrand, intercept, intparts, isolate, leftbox, leftsum, makeproc, maximize, middlebox, middlesum, midpoint, minimize, powsubs, rightbox, rightsum, showtangent, simpson, slope, trapezoid, value] -------------------------------------------------------------------------------- > completesquare(eq1,{x,y,z}); 2 2 2 (z - 2) - 21 + (y + 4) + (x + 1) = 28 -------------------------------------------------------------------------------- > "+(21=21); 2 2 2 (z - 2) + (y + 4) + (x + 1) = 49 -------------------------------------------------------------------------------- > sqrt(rhs(")); 7 -------------------------------------------------------------------------------- >