Maple Lab 0 (Spring 2007 Math 251 Sections 05-07) 

Exercises 

 

Remember that even though this lab will not count toward your final grade, you must turn it in! 

 

Note: Use appropriate colors and plot options to make your plots look nice. The appearance of 

          you lab will be factored into your grade. You may add execution groups if you need more. 

          Please delete unused execution groups. 

> restart; 1; with(VectorCalculus); -1; with(plots); -1
 

1. Create vectors <1,0,1> and <1,-2,0> give them the names "a" and "b". 

> a := `<,>`(1, 0, 1); 1
 

(Typesetting:-mprintslash)([a := Vector[column]([[1], [0], [1]], [ 

> b := `<,>`(1, -2, 0); 1
 

(Typesetting:-mprintslash)([b := Vector[column]([[1], [-2], [0]], [ 

1(a). Compute the dot product of "a" and "b" and find the cross product 

        of "a" and "b" and call it "c". Then compute the projection of "a"  

        along "b" (proj[b]*a) using Maple. 

> Typesetting:-delayDotProduct(a, b); 1
 

1 

> c := `&x`(a, b); 1
 

(Typesetting:-mprintslash)([c := Vector[column]([[2], [1], [-2]], [ 

> Typesetting:-delayDotProduct(a, b)*b/Typesetting:-delayDotProduct(b, b); 1
 

(Typesetting:-mprintslash)([Vector[column]([[1/5], [-2/5], [0]], [ 

1(b). Plot "a", "b", and "c" together along with the parallelogram which 

        is spanned by "a" and "b". Use different colors to make your plot 

        look nice. 

> A := arrow(a, shape = arrow, color = blue); -1; B := arrow(b, shape = arrow, color = green); -1; C := arrow(c, shape = arrow, color = red); -1; parallelogramAB := polygonplot3d([`<,>`(0, 0, 0), a, a+b...
A := arrow(a, shape = arrow, color = blue); -1; B := arrow(b, shape = arrow, color = green); -1; C := arrow(c, shape = arrow, color = red); -1; parallelogramAB := polygonplot3d([`<,>`(0, 0, 0), a, a+b...
A := arrow(a, shape = arrow, color = blue); -1; B := arrow(b, shape = arrow, color = green); -1; C := arrow(c, shape = arrow, color = red); -1; parallelogramAB := polygonplot3d([`<,>`(0, 0, 0), a, a+b...
A := arrow(a, shape = arrow, color = blue); -1; B := arrow(b, shape = arrow, color = green); -1; C := arrow(c, shape = arrow, color = red); -1; parallelogramAB := polygonplot3d([`<,>`(0, 0, 0), a, a+b...
A := arrow(a, shape = arrow, color = blue); -1; B := arrow(b, shape = arrow, color = green); -1; C := arrow(c, shape = arrow, color = red); -1; parallelogramAB := polygonplot3d([`<,>`(0, 0, 0), a, a+b...
 

Plot 

1(c). Define a function called "normalize" which takes in a vector as  

        input and outputs the same vector normalized. Then use your 

        function to normalize "a". 

> normalize := proc (v) options operator, arrow; v/sqrt(Typesetting:-delayDotProduct(v, v)) end proc; -1
 

> normalize(a); 1
 

(Typesetting:-mprintslash)([Vector[column]([[1/2*2^(1/2)], [0], [1/2*2^(1/2)]], [ 

2. Define "Seqn" to be the equation of the sphere whose center is (1,2,3)  

   and radius is 2. Also, define "XYplane" to be the equation of the XY-plane. 

> Seqn := (x-1)^2+(y-2)^2+(z-3)^2 = 4; 1
 

(Typesetting:-mprintslash)([Seqn := (x-1)^2+(y-2)^2+(z-3)^2 = 4], [(x-1)^2+(y-2)^2+(z-3)^2 = 4]) 

> XYplane := z = 0; 1
 

(Typesetting:-mprintslash)([XYplane := z = 0], [z = 0]) 

2(a). Plot this sphere and the XY-plane in the same window. 

> splot := implicitplot3d(Seqn, x = -5 .. 5, y = -5 .. 5, z = -2 .. 7, numpoints = 5000); -1
 

> pplot := plot3d(rhs(XYplane), x = -5 .. 5, y = -5 .. 5); -1
 

> display3d({splot, pplot}, axes = normal, scaling = constrained); 1
 

Plot 

2(b). Use the "solve" command to solve "Seqn" for the variable "z". Notice 

        there are 2 solutions. Find a Maple command to retrieve each of these  

        solutions from the set. 

> solns := solve(Seqn, z); 1
 

(Typesetting:-mprintslash)([solns := 3+(-1-x^2+2*x-y^2+4*y)^(1/2), 3-(-1-x^2+2*x-y^2+4*y)^(1/2)], [3+(-1-x^2+2*x-y^2+4*y)^(1/2), 3-(-1-x^2+2*x-y^2+4*y)^(1/2)]) 

> eqn1 := solns[1]; 1
 

(Typesetting:-mprintslash)([eqn1 := 3+(-1-x^2+2*x-y^2+4*y)^(1/2)], [3+(-1-x^2+2*x-y^2+4*y)^(1/2)]) 

> eqn2 := solns[2]; 1
 

(Typesetting:-mprintslash)([eqn2 := 3-(-1-x^2+2*x-y^2+4*y)^(1/2)], [3-(-1-x^2+2*x-y^2+4*y)^(1/2)]) 

2(c). Go back (if necessary) to part (b) and assign names to each part of the 

        solution. Then graph the upper-half of the sphere together with the XY-plane. 

> upSphere := plot3d(eqn1, x = -5 .. 5, y = -5 .. 5, numpoints = 5000); -1
 

> display3d({pplot, upSphere}, axes = normal, scaling = constrained); 1
 

Plot 

3. Let P=(1,2,0), Q=(1,-1,0), and R=(-1,-1,-2). Define "u" to be the vector from 

   P to Q and define "v" to be the vector from P to R. 

> P := `<,>`(-1, 0, 2); 1; Q := `<,>`(1, -1, 0); 1; R := `<,>`(-1, -1, -2); 1
 

(Typesetting:-mprintslash)([P := Vector[column]([[-1], [0], [2]], [ 

(Typesetting:-mprintslash)([Q := Vector[column]([[1], [-1], [0]], [ 

(Typesetting:-mprintslash)([R := Vector[column]([[-1], [-1], [-2]], [ 

> u := Q-P; 1
 

(Typesetting:-mprintslash)([u := Vector[column]([[2], [-1], [-2]], [ 

> v := R-P; 1
 

(Typesetting:-mprintslash)([v := Vector[column]([[0], [-1], [-4]], [ 

3(a). Define the cross product of "u" and "v" to be "n". Then define the equation 

        of the plane containing the points P, Q, and R to be "planeEqn". 

> n := `&x`(u, v); 1
 

(Typesetting:-mprintslash)([n := Vector[column]([[2], [8], [-2]], [ 

> planeEqn := Typesetting:-delayDotProduct(n, `<,>`(x, y, z)-P) = 0; 1
 

(Typesetting:-mprintslash)([planeEqn := 2*x+6+8*y-2*z = 0], [2*x+6+8*y-2*z = 0]) 

3(b). Define a vector function whose graph is the line which passes through the point P 

        and is perpendicular to the plane defined in part (a). Call this function "nLine". 

> nLine := proc (t) options operator, arrow; P+n*t end proc; -1
 

3(c). Then plot "planeEqn", "nLine" and the vectors "u", "v", and "n" all together in 

        the same window. Again, use different colors to make you plot look nice. 

> pplane := implicitplot3d(planeEqn, x = -7 .. 7, y = -7 .. 7, z = -7 .. 7, numpoints = 5000); -1
pplane := implicitplot3d(planeEqn, x = -7 .. 7, y = -7 .. 7, z = -7 .. 7, numpoints = 5000); -1
 

> pline := spacecurve(nLine(t), t = -.5 .. 1, axes = normal, color = black, thickness = 2, labels = ([x, y, z]), scaling = constrained); -1
pline := spacecurve(nLine(t), t = -.5 .. 1, axes = normal, color = black, thickness = 2, labels = ([x, y, z]), scaling = constrained); -1
 

> U := arrow(u, color = blue); -1; V := arrow(v, color = green); -1; N := arrow(n, color = red); -1
U := arrow(u, color = blue); -1; V := arrow(v, color = green); -1; N := arrow(n, color = red); -1
U := arrow(u, color = blue); -1; V := arrow(v, color = green); -1; N := arrow(n, color = red); -1
 

> display3d({U, N, pplane, V, pline}, axes = normal, scaling = constrained); 1
 

Plot