Draw a Right Triangle The Maple drawing tools allow you to draw single lines on
ID: 3639102 • Letter: D
Question
Draw a Right Triangle
The Maple drawing tools allow you to draw single lines on a plot. More complicated shapes can be drawn using the basic tools. This question asks about how to create a procedure called drawRightTriangle that takes in a side length size and a starting [x, y] location.
Below in an example when calling drawRightTriangle with a size of 1 starting in location [1, 1].
drawRightTriangle(1, 1, 1);
When you enter the points into the procedure, the first point should have the smaller x value. If they both have the smaller x value then use the smaller y value first. Consider the two points [2+z, 3] and [2, 4], the point [2, 4] should be entered first because the x value is smaller.
This means the points should be:
Left Line: Bottom point then Top point
Bottom Line: Left point then Right Point
Hypotenuse: Left point then Right Point
1) Complete the following procedure:
with(plots):
with(plottools):
drawRightTriangle := proc(size, x, y)
local left, bottom, hyp:
left := line([ , ], [ , ]):
bottom := line([ , ], [ , ]):
hyp := line([ , ], [ , ]):
return display([left, bottom, hyp]);
end proc;
2) How do you draw a right triangle starting at [-4, -1] of size 4?
( , , );
Draw a Right Triangle
The Maple drawing tools allow you to draw single lines on a plot. More complicated shapes can be drawn using the basic tools. This question asks about how to create a procedure called drawRightTriangle that takes in a side length size and a starting [x, y] location.
Below in an example when calling drawRightTriangle with a size of 1 starting in location [1, 1].
drawRightTriangle(1, 1, 1);
When you enter the points into the procedure, the first point should have the smaller x value. If they both have the smaller x value then use the smaller y value first. Consider the two points [2+z, 3] and [2, 4], the point [2, 4] should be entered first because the x value is smaller.
This means the points should be:
Left Line: Bottom point then Top point
Bottom Line: Left point then Right Point
Hypotenuse: Left point then Right Point
1) Complete the following procedure:
with(plots):
with(plottools):
drawRightTriangle := proc(size, x, y)
local left, bottom, hyp:
left := line([ , ], [ , ]):
bottom := line([ , ], [ , ]):
hyp := line([ , ], [ , ]):
return display([left, bottom, hyp]);
end proc;
2) How do you draw a right triangle starting at [-4, -1] of size 4?
( , , );
Explanation / Answer
with(plots): with(plottools): drawRightTriangle := proc(size, x, y) local left, bottom, hyp: left := line([ 2 , 4 ], [ 3 , 6 ]): bottom := line([ 6 , 5 ], [ 6 , 6 ]): hyp := line([ 1 , 5 ], [ 4 , 6 ]): return display([left, bottom, hyp]); end proc;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.