[Edu-sig] Review of Some Math-Through-Programming Themes

Patrick K. O'Brien pobrien@orbtech.com
Fri, 12 Oct 2001 16:53:14 -0500


Kirby,

As much as you like coding directly in the Python shell, I was wondering if
you had tried the PyCrust shell (http://sourceforge.net/projects/pycrust/).
It has a couple of features that I think are particularly well suited to
students:

1. Call tips for functions and methods that display the parameters required
and the documentation string. This information pops up in a balloon-style
box underneath the current line of code when you type in a function followed
by a left parenthesis.

2. Command auto-completion that pops up a list of valid attributes
(properties and methods) for the current object whenever you type an object
name followed by a dot.

3. Colorized code, and basic syntax checking.

4. Namespace inspection through a tree control that allows you to drill down
through all objects in the current local namespace. Objects selected in the
tree control display information about themselves, including the source code
upon which they are based.

5. You can create applications in wxPython or Tkinter or scipy or PythonCard
directly in the shell and control them interactively without the lockups or
conflicts that you have in other shells. It even works with Zope and ZODB.

I use PyCrust every day and rely on these features to help me understand
what is really happening in the Python environment, and to reduce keying
errors. Of course, I wrote PyCrust, so I'm biased. Which is why I'd love to
hear from the education community. If you are using PyCrust, or having
suggestions for improvement, please send them my way. Thanks.

---
Patrick K. O'Brien
Orbtech (http://www.orbtech.com)
"I am, therefore I think."

-----Original Message-----
From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On Behalf Of
Kirby Urner
Sent: Friday, October 12, 2001 4:10 PM
To: mathedcc@mathforum.com
Cc: edu-sig@python.org
Subject: [Edu-sig] Review of Some Math-Through-Programming Themes


       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
coding of same in some computer language, so that
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
programming, plus the development environment is cramped.

I've advocated using this approach starting around 8th
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
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
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
classes and objects just as new users of telephones might
start with a wireless unit.

The object-oriented approach turns out to be especially handy
in mathematics learning, as it often allows us to keep our
syntax relatively close to that of the traditional text book
notations.  For example, with Fraction objects, symbolized by
F, we can add, subtract, multiply, divide, and raise them to
powers just as we would integers, i.e. with the direct application
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
numerators and denominators?  Sure, many do.  The fun and instructive
part is that we coded the Fraction object ourselves, and therefore
had to develop our understanding of the role of GCD and LCD in these
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
bring this ancient method back into pre-algebra, (later we'll
introduce and use the extended version or EEA, which plays a
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
be tedious and error-prone if figured on pencil and paper.
In other words, we want to understand the paper and pencil
way of doing things, but then code them so we can do the
calculations quickly and reliably.

Note that I'm not talking about approximating precise answers
with floating point operations in this context.  On the
contrary, now that we have fraction objects, we're in a
position to push beyond what floating point numbers are able
to tell us.  We'll stay in the realm of purely rational
numbers p/q, where p and q are both whole (q nonzero).

So far, I've explored and written up three useful topics to
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
that would be relatively difficult and tedious with paper
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
math object, the polynomial.  They also make an appearance
in the context I recently posted about:  figurate numbers, as
per the approach taken in 'The Book of Numbers' in Conway and
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
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]

Finally, we might also develop Polyhedron objects, using
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
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
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
     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
     http://www.mathforum.com/epigone/nctm.l/sangjalskeld

[3]  Pool Hall Math
     http://www.mathforum.com/epigone/nctm.l/ningdimfrimp

[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



_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig