Module 2 : Geometry

201 : Points & Polygons

O B J E C T I V E

In this project we will learn some basic concepts......

S E T U P

In this project we will use the following command packages. Type and execute this line before begining the project below. If you re-enter the worksheet for this project, be sure to re-execute this statement before jumping to any point in the worksheet.

> restart; with(plots): with(geometry): with(student):

Warning, the name changecoords has been redefined

Warning, the names distance, midpoint and slope have been redefined

___________________________________________________________________________________

A. Points & Segments

___________________________________________________________________________________

Were going to define and graph points and line segments. Were going to use this straight forward method, but it should be noted that Maple offers an alternative way of doing these same things in the geometry package using a slightly different syntax which we will use in later modules.

POINTS

We will define points by specifying coordinates using square brackets. We can also name points and graph them.

> A := [-5,2]; B := [-1,7]; C:=[6,2];

A := [-5, 2]

B := [-1, 7]

C := [6, 2]

> plot( {A, B, C}, x = -8..8, y = -4..12, style = point);

[Maple Plot]

We can also plot points directly.

> plot( {[-3,2], [6,4] }, x = -8..8, y= -4..12, style = point);

[Maple Plot]

SEGMENTS

Just as easily we can define line segments as two points enclosed in square brackets.

> seg := [[ -3, -2],[4,5]];

seg := [[-3, -2], [4, 5]]

> plot( seg, x = -5..5, thickness = 4, color = gold, scaling = constrained);

[Maple Plot]

We can also several segments at the same time directly by enclosing the segments in set braces.

> plot( { [[-7,2],[6,2]], [[-4,10],[7,4]],[[-4,1],[5,8]] }, x = -8..8, y = -4..12, thickness = 4, color = [gold, khaki, plum], scaling = constrained);

[Maple Plot]

To keep organized, the best way is to define points, as we did above, and then define segments as the two points enclosed in square brackets.

As you can see, this creates a triangle!

> AB := [ A, B]; BC := [B, C]; AC := [A, C];

AB := [[-5, 2], [-1, 7]]

BC := [[-1, 7], [6, 2]]

AC := [[-5, 2], [6, 2]]

> plot( {AB, BC, AC}, x = -8..8, y = -4..12, thickness = 4, color = khaki, scaling = constrained );

[Maple Plot]

DISTANCE

Line segments have length which is the same thing as the distance between the points.

> with( student):

> distance( [1,5], [-7, 4] );

sqrt(65)

> distance( A, B);

sqrt(41)

We can find the distance between each pair of points defined above.

> dAB := distance( A, B);

dAB := sqrt(41)

> dBC := distance( B, C);

dBC := sqrt(74)

> dAC := distance( A, C);

dAC := 11

> perimeter := dAB + dBC + dAC;

perimeter := sqrt(41)+sqrt(74)+11

___________________________________________________________________________________

B. Triangles

___________________________________________________________________________________

Above we defined a triangle by first defining three points, then the three segments that join them. Here we will use a little more sophisticated block of commands to do all of that, plus graph the triangle and automatically adjust the size of the graph to fit the triangle.

AUTOMETIC TRIANGLES

> tri_plot := proc( A, B, C) local AB,BC,AC, mx, Mx, my, My ;
AB:=[ A, B]; BC:=[ B, C ]; AC:=[ A, C ];
mx := min( A[1], B[1], C[1]);
Mx := max( A[1], B[1], C[1]);
my := min( A[2], B[2], C[2]);
My := max( A[2], B[2], C[2]);
plots[display]( plot({AB, BC, AC }, x = (mx-1)..(Mx+1), y = (my-1)..(My+1),
thickness= 4, color = green, axes = boxed, scaling = constrained ),
plots[textplot]({[A[1], A[2],"A"],[ B[1],B[2],"B"],[C[1],C[2],"C"]},
font=[HELVETICA,BOLD,14]) ); end:

To use this triangle graphing procedure, simply type its name and three points

Notice that it labels the points A, B, C in the same order you specified them.

> tri_plot( [-5,2], [-1,7],[6,2] );

[Maple Plot]

Here is another version of the triangle plot command we created above.

> tri_plot := proc( A, B, C) local AB,BC,AC,mx,Mx,my,My,x1,x2,x3,y1,y2,y3,dAB,dBC,dAC;
AB:=[ A, B ]; BC:=[ B, C ]; AC:=[ A, C ];
mx := min( A[1], B[1], C[1]); Mx := max( A[1], B[1], C[1]);
my := min( A[2], B[2], C[2]); My := max( A[2], B[2], C[2]);
x1 := (A[1]+B[1])/2; y1 := (A[2]+B[2])/2;
x2 := (B[1]+C[1])/2; y2 := (B[2]+C[2])/2;
x3 := (A[1]+C[1])/2; y3 := (A[2]+C[2])/2;
dAB := student[distance]( A, B );
dBC := student[distance]( B, C );
dAC := student[distance]( A, C );
plots[display]( plot({AB, BC, AC }, x = (mx-1)..(Mx+1), y = (my-1)..(My+1),
thickness= 4, color = coral, axes = boxed, scaling = constrained ),
plots[textplot]({[A[1],A[2],"A"],[B[1],B[2],"B"],[C[1],C[2],"C"]},
font=[HELVETICA,BOLD,14]),
plots[textplot]({[x1,y1, convert(evalf(dAB,5), string)],
[x2,y2 ,convert(evalf(dBC,5), string)], [x3,y3 ,convert(evalf(dAC,5), string)]}));
end:

We use this in the same way. Lets use the command see what this new version does.

The length of each edge is now labeled also!

> tri_plot( [-5,2],[-1,7],[6,2] );

[Maple Plot]

___________________________________________________________________________________

C. Polygons

___________________________________________________________________________________

Triangles are polygons of three sides. We can use Maple's built - in capabilities to display more general polygons.

> polygonplot( [ [-2,0],[-3,12],[4,8],[7,1],[3,-3] ], color = gold);

[Maple Plot]

QUADRILATERALS

Quadrilaterals, which are four sided polygons, come in many varieties : squares, rectangles, parallelograms, trapezoids, rhombuses and otehr shapes which do not have any special name.

> polygonplot( [ [-7,-4],[-4,11],[7,11],[4,-4] ], color = gold);

[Maple Plot]

> polygonplot( [ [-5,-1],[-2,11],[7,-1],[1,-3] ], color = gold, scaling = constrained);

[Maple Plot]

OTHER POLYGONS

There are much more general polygons also.

> polygonplot( [ [-20,-3],[-17,6],[-10,8],[-2,15],[5,3],[10,3],[13,-7] ], color = gold);

[Maple Plot]

>