[Edu-sig] Review of Some Math-Through-Programming Themes
Kirby Urner
urner@alumni.princeton.edu
Fri, 12 Oct 2001 14:10:27 -0700
Review of Some Math-Through-Programming Themes
by K. Urner, Oct 12, 2001
My suggestion to curriculum writers has been to return
to the front pioneered using BASIC and Logo: integrate
the teaching of paper and pencil algorithms with the=20
coding of same in some computer language, so that=20
students reap the benefits of contemporary engineering.
Once programming enters the picture, I prefer a general
purpose computer language to a calculator language, as
these latter don't supply as broad a foundation in=20
programming, plus the development environment is cramped.
I've advocated using this approach starting around 8th=20
grade to learn math concepts by building math objects.
This is a sort of hands-on approach, suggestive of shop
class or labs, wherein we actually construct gizmos=20
which embody our understanding of the relevant ideas.
A first object we might construct is the Fraction object.
I emphasize "object" because, unlike with the Logo or BASIC=20
languages of the 1980s, we're now in a position to introduce
students to a later programming paradigm, that of objects.
This doesn't have to be considered "advanced" -- it's just
a paradigm. Newcomers to programming might start with=20
classes and objects just as new users of telephones might=20
start with a wireless unit.
The object-oriented approach turns out to be especially handy=20
in mathematics learning, as it often allows us to keep our=20
syntax relatively close to that of the traditional text book=20
notations. For example, with Fraction objects, symbolized by=20
=46, we can add, subtract, multiply, divide, and raise them to=20
powers just as we would integers, i.e. with the direct application=20
of the relevant operators:
>>> from mathobjects import Fraction as F
>>> F(1,2)
(1/2)
>>> F(1,2) + F(1,3) + F(3,7)
(53/42)
>>> F(2,3) * F(1,2)
(1/3)
>>> F(3,5)**2
(9/25)
So what? Don't calculators also allow such expressions using=20
numerators and denominators? Sure, many do. The fun and instructive
part is that we coded the Fraction object ourselves, and therefore=20
had to develop our understanding of the role of GCD and LCD in these=20
various operations. We actually "built" the object we're now using
in the above, simple, expressions.[1] (Note that we'll use the
Euclidean Algorithm (EA) to implement GCD -- we really need to=20
bring this ancient method back into pre-algebra, (later we'll=20
introduce and use the extended version or EEA, which plays a=20
critical role in RSA cryptography)).[2]
So now that we have a Fraction object, we'd like to explore
other algorithms in which Fractions occur, and which would=20
be tedious and error-prone if figured on pencil and paper.
In other words, we want to understand the paper and pencil=20
way of doing things, but then code them so we can do the=20
calculations quickly and reliably.
Note that I'm not talking about approximating precise answers
with floating point operations in this context. On the=20
contrary, now that we have fraction objects, we're in a=20
position to push beyond what floating point numbers are able
to tell us. We'll stay in the realm of purely rational=20
numbers p/q, where p and q are both whole (q nonzero).
So far, I've explored and written up three useful topics to=20
which our newly developed fraction object might apply:
(1) Continued Fractions (recursion, phi)
http://www.mathforum.com/epigone/math-teach/smersmarzand
(2) Derangements (more links to combinatorics)
http://aspn.activestate.com/ASPN/Mail/Message/edu-sig/788963
(3) Bernoulli numbers (links to Pascal's Triangle)
http://www.mathforum.com/epigone/nctm.l/flanghoupah
All of the above make use of the Fraction object in ways=20
that would be relatively difficult and tedious with paper=20
and pencil. However, by tackling the algorithms and concepts
behind the scenes, we nevertheless gain exposure to important
techniques and generalizations, as well as history.
The Bernoulli numbers thread provides a segue to another=20
math object, the polynomial. They also make an appearance=20
in the context I recently posted about: figurate numbers, as=20
per the approach taken in 'The Book of Numbers' in Conway and=20
Guy, and posted about by myself under the heading of 'Pool
Hall Math' (because we're stacking/packing pool balls).[3]
After we build the Fraction and Polynomial objects, and use
these to anchor a lot of relevant mathematics, we'll move=20
on the the Vector and Matrix objects (which synergize with
the previous objects, e.g. the characteristic polynomial
of a square matrix -- which might have fractional coefficients).[4]
=46inally, we might also develop Polyhedron objects, using=20
the matrix and vector objects as a part of their definition.
The generic methods for rotating, translating, scaling a poly
go in the superclass definition, while the individual polyhedra
are defined as subclasses (this follows a classic OO text book=20
model, except usually the text books stick with planar shapes,
which are less beautiful and interesting -- why not use the
technology to its fuller potential?).
Note: rotation of polyhedra provides a segue to quaternion=20
objects if we like -- another way of implementing rotation.[5]
All of this connects back to my 'Trends in Early Mathematics Learning'
essay, wherein I envision a greater integration of math education
and computer science under the more generic umbrella of "numeracy".[6]
Kirby
[1] Tutorial on developing a Fraction object using the=20
Python language, posted to math-learn:
http://www.mathforum.com/epigone/math-learn/starcrumderm
[2] Euclidean Algorithm
http://www.mathforum.com/epigone/math-learn/vultingsheld =20
http://www.mathforum.com/epigone/nctm.l/sangjalskeld
[3] Pool Hall Math
http://www.mathforum.com/epigone/nctm.l/ningdimfrimp =20
[4] Characteristic polynomials using mathobjects
http://aspn.activestate.com/ASPN/Mail/Message/580745
[5] 'Getting Inventive with Vectors' (CP4E 4-part essay)
http://www.inetarena.com/~pdx4d/ocn/numeracy1.html
[6] 'Trends in Early Mathematics Learning: Beyond Y2K'
http://www.inetarena.com/~pdx4d/ocn/trends2000.html