TEACHING MATH THROUGH PROGRAMMING

INTRODUCTION: Seymour Papert has argued that students often have difficulty learning mathematics because they are not immersed in an environment which requires them to use such principles. In order to provide such an environment, Papert and his associates at MIT developed the Logo programming language. Logo is a graphically oriented programming language in which students can readily see the results of their commands. It is capable of using many standard mathematical functions, and allows the user to define his or her own functions. The results of a student's program are portrayed graphically so the influence of specific commands can be readily observed.

Logo Versions

(1) Creating Designs: Use Hyperlogo, Terrapin Logo or Apple Logo to create the following designs. Save your procedures with an appropriate file name. Submit a printout of your drawings and program listings.

(a) Create a procedure that will generate polygon of any number of sides.

(b) Create a procedure that will draw a house with chimney, windows and a door.

(c) Create a procedure that will draw an Olympic flag (in color).

(2) Teaching Mathematics and Problem Solving Through Programming :

Give a detailed list of all of the mathematics skills used in this activity. Explain how each skill was employed.

(3) Geometric Transformations with Logo. The Transformers file has the following procedures. MARK, START, RT.TRI, REFLECT.H, RATIO :N, BOX, AXES, ROTATE :D, TRANSLATE :X :Y, REFLECT.V, REPLACE, REMEMBER, TEE, PENTA. (a) Use reflect.h (reflect horizontal), reflect.v (reflect vertical); ratio (scale the object); translate (move the object); and rotate (turn the object) to move the transform the first object in quadrant 1 into the second object. Use as few of steps as possible. Include in your portfolio printouts of your graphs and documentation indicating the sequence of procedures used to transform each object.

  • Open the Logo Editor by typig ED from the command line.
  • Copy and paste the purple code below into the editor
  • Save as transformers onto your drive: SAVE "TRANSFORMERS
  • Start transformers by entering AXES at the command line.
  • To execute a procedure, enter its name. For example, to create a box type BOX.
  • To transform a figure, type the name of the transformation procedure followed by the procedure name. For example, to horizontally reflect a box, type REFLECT.H BOX
Shapes
PENTA Pentagon
RT.TRI Draws a right triangle.
BOX Draws a rectangle
AXES Redraws axes
TEE Draws a "T" Shaped object.
Transformations
RATIO : N Increases or decreases size of the procedure. For example, RATIO : .5 BOX will shrink a box to 50% its original size.
REFLECT.H Reflects the object across the horizontal axes. For example, REFLECT.H BOX will flip the box across the horizontal axis.
REFLECT.V Reflects the object across the vertical axes. For example, REFLECT.V BOX will flip the box across the vertical axis.
ROTATE :D Rotates the object specified number of degrees. For example, ROTATE 90 BOX will rotate a box 90 degrees.
TRANSLATE :X :Y Moves the object to the new location. For example TRANSLATE 0 0 BOX will draw a box at the origin.

Code for Geometric Transformations

TO AXES
START
CLEARSCREEN
PENUP SETPOS [-140 0] PENDOWN
SETHEADING 90
FD 275
PENUP SETPOS [0 -140] PD
SETHEADING 0
FD 275
PENUP SETPOS [50 50] PENDOWN
END
 
TO BOX
SETPC 5
REPEAT 2 [FD :S RT 90 * :A FD :S * 2 RT 90 * :A]
MARK
END
 
TO MARK
REPEAT 4 [FD 6 RT 90 * :A]
END
 
TO PENTA
PU BK :S / 2 * 1.37 PD
LT 90 * :A MARK
FD :S / 2 RT :A * 72
REPEAT 2 [FD :S RT 72 * :A]
LT 72 * :A
REPEAT 3 [RT 120 * :A FD 9]
RT 72 * :A
REPEAT 2 [FD :S RT 72 * :A]
FD :S / 2 RT 90 * :A
PU FD :S / 2 * 1.37 PD
END
 
TO RATIO :N
MAKE "S :N * :S
SETPC 3
END
 
TO REFLECT.H
MAKE "X -XCOR
MAKE "Y YCOR
MAKE "H -HEADING
MAKE "A -:A
PENUP SETPOS SE :X :Y PENDOWN
SETHEADING :H
SETPC 3
END
 
TO REFLECT.V
MAKE "Y -YCOR
MAKE "X XCOR
IF ( OR HEADING < 180 HEADING = 180 ) [MAKE "H 180 - HEADING]
IF HEADING > 180 [MAKE "H 540 - HEADING]
PU SETPOS SE :X :Y PD
MAKE "A -:A
SETHEADING :H
SETPC 3
END
 
TO REMEMBER
MAKE "ORIG.S :S
MAKE "ORIGI.X XCOR
MAKE "ORIGI.Y YCOR
MAKE "ORIGI.A :A
MAKE "ORIG.H HEADING
END
 
TO REPLACE
SETPOS SE :ORIG.X ORIG.Y
SETHEADING :ORIG.H
SETPC 1
PENDOWN
MAKE "A :ORIG.A
MAKE "S :ORIG.S
END
 
TO ROTATE :D
RIGHT :D
SETPC 3
END
 
TO RT.TRI
SETPC 9
FD :S RT 120 * :A
FD :S * 2 RT 150 * :A
FD :S * 1.7300000000116 RT 90 * :A
MARK
END
 
TO START
MAKE "A 1
MAKE "S 30
SETPC 1
END
 
TO TEE
PU LT 90 * :A FD 5 PD
FD 25 RT 90 * :A
MARK
FD 10 RT 90 * :A
FD 60 RT 90 * :A
FD 10 RT 90 * :A
FD 25 LT 90 * :A
FD 40 RT 90 * :A
FD 10 RT 90 * :A
FD 40 RT 90 * :A
PU FD 5 LT 90 * :A PD
END
 
TO TRANSLATE :X :Y
PENUP
SETPOS SE :X :Y
PENDOWN
SETPC 3
END
 
Make "a -1
Make "h 0
Make "s 30
Make "x 0
Make "y 0