sa: Pythonic Mathematics

First posted: May 13, 2007
Last Modified: June 13, 2007

mite rendering

Fig 1: Marble MITE (1/8th Coupler) in a Silver Cube

I developed this course for Saturday Academy (sa:) in the spring of 2007. My goals were to increase students' comfort level eyeballing source code and to develop a lexical-graphical bridge of concepts and experiences, whereby this source code would connect to various geometric vistas featuring polyhedra.

Students would come away from this course appreciating how the mathematical model (lexical) drives the views (graphical).

Given my work in Portland's "toontown" and the emerging career prospects for those wishing to venture into computer animation, my focus in the geometry department was two broad categories of computer graphics engine we have to work with: real time game engines and render time ray tracing engines.

Both types of engine apply textures and perspective, but ray tracers work much more slowly, analyzing each beam of light from a light source, resulting in a potentially high degree of photo realism.

Interactive games like Alice depend on computing everything in real time while sustaining a frame rate at movie speeds. Movies like Cars depend on frame-by-frame rendering (often on render farms), with real time frame rates attained only during playback of the final result.

source code

Fig 2: source for rendering Fig 1.

Given my students were beginning programmers, I stressed their recog over their recall abilities, by which I mean it's easier to recognize and modify already written code than it is to synthesize working code from scratch. I provided basic Vector, Edge and Polyhedron classes, then had students focus on two testing frameworks, one aimed at VPython, a real time wrapper around OpenGL, the other aimed at POV-Ray, the famously free and capable ray tracer.


Fig 3: Model, View, Controller


Fig 4: parallel modules for different Views of the same Model

In addition to experimenting with the testing frameworks, we watched short movies, excerpts from longer ones, including Warriors of the Net (about how the Internet works), Code Guardian (a great example of render time movie-making), and Revolution OS (good background on the origins of the open source movement).


Fig 5: our sa: classroom at Portland State

Students who've had some exposure to vector algebra in their previous classes will have an edge over those with less familiarity coming in to this class. However, the testing frameworks are such that students have multiple ways to tweak and extend the code.

In what other ways might students morph or refactor the supplied starting code, in ways commensurate with developing skills and/or interests?

The Model and Views aren't as strictly separated as they might be. VPython in particular feels more like it's Standard Library, taken for granted. But even the lowest Edge class reflects texture and color information, i.e. "secondary characteristics," so-called by Enlightenment Era philosophes wishing to make "extension" the only primary thing -- a distinction superseded or at least refined by the "eternally shaped versus temporarily shaped + energized" distinction (angle vs. frequency, 4D vs. 4D++) of the Synergetics namespace.

Fig 6: sa: class handout

There'd also be the option, explored by me as well, to use Chakovian Coordinates instead of the traditional XYZs. At the very least, we'd like Vectors to know their spherical coordinate positions as certainly as their XYZ ones. Add whatever isomorphic and/or over-determined homomorphic addressing schemes you like, using Python to administer casting from format to format (a difference in API more than type, which remains Vector).

Fig 7: POV-Ray Documentation re Left vs. Right XYZ coordinate systems

How one chooses to extend the code and concepts herein really depends a lot on one's academic context i.e. whether we're in the philosophy department, with a history of science dimension, or some engineering department, perhaps with a focus on Elastic Interval Geometry (EIG) ala Springie, Springdance and Fluidiom ((tensegrity simulators), or maybe on Koski's phi-scaled T-module dissections.

Fig 8: our main menu in

Another aspect of my course is I helped familiarize students with and the surrounding subculture, which includes a shared history, various touch stones (including puns, jokes), characters, import this (an "easter egg" by Tim Peters). At the time, in May of 2007, relevant local events included a first Portland BarCamp, and a Python Meetup.

Despite all this emphasis on Python, I was consistent with my message that computer languages are tools and one chooses tools depending on the job. Learning Python is an end in itself for some of us, but is also a means to an end, a stepping stone towards learning other computer languages.

For further reading:

oregon.gif - 8.3 K
Oregon Curriculum Network