Learning in Stereo: Math + Python

Kirby Urner urner at alumni.princeton.edu
Sun Apr 2 14:10:44 EDT 2000


Re: "Learning in Stereo" by K. Urner (April 2, 2000)

VHLLs (very high level languages) are human-readable
-- not just computer-readable.  

VHLL programs = notations suitable for expressing 
high precision ops -- such as we find in math books.

Yes, of course, we still need to learn the time-honored 
symbols, like SIGMA (<- capital greek letter goes here), 
accepted internationally and accessible to all with 
the proper training (and the right typesetting equipment)

But why not "hit two targets with one throw" and learn 
a VHLL in tandem?  Everyone should know some computer
language or other, n'est pas?

By learning a VHLL in tandem with math, you'll be able 
to translate back and forth between math symbols and 
a computer language -- using each to interpret the 
other (call it "learning in stereo").

Enter Python, a VHLL eminently suitable to this task:

  >>> def sigma(n,func): 
        sum = 0
        for i in range(1,n+1):
           sum = sum + func(i)
        return sum

  >>> def f(x):
        return 1.0/(x*x)

  >>> def pi(n):
        return (6 * sigma(n,f))**0.5

  >>> pi(100)
  3.04936163598

  >>> pi(10000)
  3.14149716395

Yes, we're converging to PI ( = 3.14159...) albiet very 
slowly.  In other words (in more conventional math 
notation):

  PI^2
  ---- = 1 + 1/4 + 1/9 + 1/25 + 1/36 ...
    6
          
       = SIGMA [ 1/i^2]
         i = 1

  i.e. PI = [ 6 * SIGMA [1/i^2] ]^(1/2)
                  i = 1

At my Oregon Curriculum network website, you'll find a
4-part essay entitled 'Numeracy + Computer Literacy' 
series.  This will give you a clear idea of my approach.

See: http://www.inetarena.com/~pdx4d/ocn/cp4e.html

Is this a new idea?  Not really -- people have used 
BASIC for the same purpose.  But Python has a more up 
to date design, is the "new BASIC" for people just 
starting out today.  Your kids get to start with 
something better than you had as a kid.

Of course what you learn from Python you can adapt to 
other languages, such as Java, C/C++ and Perl.  

In the mean time, why not teach and/or learn object 
oriented programming and spatial geometry at the same 
time?  The math might come in handy as well.

This what we're cooking up at the Oregon Curriculum 
network website.

Come on by and give us a try!

Kirby
Curriculum writer





More information about the Python-list mailing list