[Edu-sig] modeling the rational numbers

Andre Roberge andre.roberge at gmail.com
Fri Aug 24 02:16:27 CEST 2007


On 8/23/07, Michel Paul <mpaul at bhusd.k12.ca.us> wrote:
> Here is a little summer project I'd like to share.
>
> This is simply a Python module that blends text and code.

Have you looked at Crunchy?   (http://code.google.com/p/crunchy)

Crunchy allows you to "blend"  (to use your expression) html text and
Python code.  You can view the file in your browser and interact
(execute the code) in it.

Quoting from your file:
===
If you arrange this window and the Shell side by side, you will be able to
easily test the code you are studying as you read through the lesson.
===
Crunchy makes the file much easier to read and interact with: you can
have every thing in the same window.  (no need for a separate editor
and a separate shell)

But, then again, perhaps I am a bit biased  ;-)

André Roberge




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
>
>
>
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
>
>


More information about the Edu-sig mailing list