[Edu-sig] modeling the rational numbers

Michel Paul mpaul at bhusd.k12.ca.us
Fri Aug 24 01:35:30 CEST 2007


Here is a little summer project I'd like to share.  

This is simply a Python module that blends text and code.  The idea is that a student can read the file just like any text file, but they can simultaneously interact with its code in the Shell.  I think this is a very useful and simple format.

The goal here is to create something that would be of value to both math and programming students.  A math student wouldn't have to understand the code in order to use it.  However, it's all there if they want to inspect it.  Hopefully an interested reader would end up learning both some math and some programming.

In the beginning I refer to using tuples to represent fractions and Cartesian points.  That is because I had created some earlier lessons where I was trying to keep things minimal.  However, in this lesson it makes a lot of sense to introduce a simple Rational class.  I only implement __init__ and __repr__, making it kind of a fancy struct.  With just that very simple class and a function to generate the mediant of two rationals, you can generate ALL non-negative rationals!  It's really very interesting.  

If used in a programming class, we would of course then go back and fill in the Rational class with __add__, __mul__, etc.  But in the context of a typical math class where many of the students aren't sure they even want to learn programming at all, I think this kind of an approach could be useful.  They could use the code as is, and, who knows, they might even be intrigued to try to understand it?

I've noticed that LOTS of students don't really have a good grasp of the rationals at all, and that's not good.  It is only by means of the rational that you can articulate the irrational.  I just recently discovered Farey sequences and Ford circles.  These things have been around now for awhile, but I don't think I've ever seen them discussed in a high school math text!  

I appreciate any suggestions, especially along programming lines, that people may have.

Thanks,

- Michel Paul



-------------- next part --------------
A non-text attachment was scrubbed...
Name: modeling rational numbers.py
Type: application/octet-stream
Size: 6867 bytes
Desc: modeling rational numbers.py
Url : http://mail.python.org/pipermail/edu-sig/attachments/20070823/7fdcff85/attachment-0001.obj 


More information about the Edu-sig mailing list