Python in "math through programming" curriculum
Kirby Urner
urner at alumni.princeton.edu
Mon Dec 18 17:07:12 EST 2000
Repost from edu-sig at python.org elist -- one typo/URL fixed.
=============================
List-Archive: <http://www.python.org/pipermail/edu-sig/>
Date: Mon, 18 Dec 2000 01:08:01 -0800
I've upgraded http://www.inetarena.com/~pdx4d/ocn/clubhouse.html
to include some RSA stuff. I think that page is finally
close to done and I plan to give it a rest.[1]
In exploring the web for relevant input, it became clear
to me that I'm venturing in territory typically covered
in college computer science courses.
That doesn't need to change, but I remain persuaded that
by adopting a "computer at your elbow" approach to math
teaching, we could have a lot more segues between K-12
and what's now considered college-level material.
Awhile back, Tim Peters recommended 'Concrete Mathematics'
(Knuth a co-author) as a good example of a "math through
programming" text book. I subsequently bought it, and
had to agree. So how do we "lower a ladder" to middle
and high schoolers starting from there? I think Python
is part of the answer.
In sum, none of the content I'm covering in my curriculum
writing is really new. All that I'm doing is wiring up
the topics in a somewhat different way, changing the mix,
reorganizing the hyperlinks. This is a fairly conservative
approach, in other words.[2]
However, I think the result could be a much higher level
of math appreciation for younger students (or for adults
returning for more), plus better segues into computer
science, for those wishing to go that route.
>"We have to reinvent the wheel every once in a while,
>not because we need a lot of wheels; but because
>we need a lot of inventors." - Bruce Joyce
>
>I've always loved that quote (and the book in which I found it,
>for that matter ;-) so I greatly appreciated these comments
>by Kirby.
>
>jeff
That's a great quote jeff, hadn't seen it before. Thanks
for posting it.
Kirby
Notes:
[1]
The Miller-Rabin stuff was confusing because I think some
web authors don't communicate it properly. Fortunately,
Knuth includes it in 'The Art of Programming' vol 2 (took
me awhile to realize that) and his Algorithm P on pg. 395
seems pretty clear -- helped me streamline the gist of the
test:
Given candidate prime n, random base b < n, and m,s such
that m*(2**s) = n-1:
def algP(m,s,b,n):
"""
based on Algorithm P in Donald Knuth's 'Art of
Computer Programming' v.2 pg. 395
"""
result = 0
y = pow(b,m,n)
for j in range(s):
if (y==1 and j==0) or (y==n-1):
result = 1
break
y = pow(y,2,n)
return result
If this spits back a 1, your candidate n passes the test
for base b. The idea is to test a number of random bases
(except I go with low primes in sequence, as per Paul
Emerson's thesis, an OK alternative, yes?) -- the more
bases you test, the higher chance a number still passing
is prime; with the chance of being wrong equal to
(1./4)**(number of tests) -- gets small quickly.
Anyway, the above source is quite a bit more succinct
than before.
[2]
Probably the one thing I include that's controversial is
mention of Bucky Fuller's concentric hierarchy of polyhedra
-- a way of scaling/organizing common polys which brings
out some whole-number relationships and morph-relationships
which geometers haven't traditionally focussed on (even
though they've always been there). I think Fuller's
approach is a pedagogic advance and makes polys more
friendly to younger people (a thesis I've empirically
tested in the field, with good results). Plus it phases
in sphere packing in tandem with the polys, and that's
highly useful as well. (Note: Alexander Graham Bell was
also obsessed with the tetrahedron, not just Bucky).
With more polyhedra earlier in the curriculum, we have
more opportunities to use them later (say in high school)
as objects subjected to transformations (scaling, translation,
rotation), using object-oriented programming techniques.
Lots of intro-to-OOP books use polygons as example objects,
(e.g. triangle as a subclass of polygon), but I'd go with
full-fledged polyhedra instead (e.g. tetrahedron as a
subclass of polyhedron). With polyhedra, your Python can
be about manipulating 3-tuple vectors (x,y,z), not just
planar (x,y) vectors, and the graphics/animations will
be far more interesting. Plus you might want to explore
with quadrays -- another wrinkle/feature in my curriculum
writing: see http://www.teleport.com/~pdx4d/quadrays.html
for more info.
More information about the Python-list
mailing list