[Edu-sig] Pythonic Math: notes re today's experience

kirby urner kirby.urner at gmail.com
Sun Apr 29 03:10:08 CEST 2007


So I showed up to a locked room, hefting my own speakers, laptop,
other props, with parents/students queuing in the hallway.  Security
showed shortly and opened the lab.  Setup took longer without the help
I got last week, but the training had been adequate and we managed to
project 'Revolution OS' excerpts, Python source.

The picture was none too bright though.  Next week I'll bring the
partnership's Optoma and stop using PSU's math department's bulb time.

Forgetting the trick for connecting to the Internet for the moment (I
later remembered), I had to talk my students through where to find
viztoyz without projecting, which turned out to be right here in this
mailing list archive, accessed via python.org | community | sigs |
edu-sig.

Then they also needed stickworks from 4dsolutions.net | ocn | python,
where ocn is my Oregon Curriculum Network (in operation for many years
by now, its content a feature at three OSCONs, a EuroPython, a Pycon,
a LinuxFest in Bellingham, Washington, many other events (I'm
something of a "known quantity" on the
Python circuit by now, try to fight typecasting by always changing my act)).

These two Python modules, plus visual (VPython.org) = a fun framework
for playing with OpenGL.

A major theme of this course:

We have these two kinds of engine:

(A) the "real time" on-the-fly graphical engine, designed to be
interactive with users, like in computer games and some simulations
(operating systems are another good example of a "real time
responsive" type engine)

(B) the "faux time" ray tracing engine, maybe slaved on a render farm
(maybe standalone on your desk), not operating in real time but
generating each frame very slowly, with painstaking attention to every
ray of light.  These frames then string together for projection at
real action speeds, providing a far higher degree of real or
surrealism in the final result than most games.

The difference between (A) and (B) accounts for the lower apparent
resolution of computer games, even higher end ones, next to the
production values in movies like 'Cars', 'Over The Hedge' and/or
'Shrek' for example.

Valve addressed a different set of problems with the Half Life 2
engine, Id with the Doom and Quake engines, than the set of problems
addressed by a render farm slave at ILM or Weta.

So I'm using VPython to stand in for an (A) type engine, a wrapper
around OpenGL (DirectX being another famous engine), and POV-Ray to
stand for a (B) type engine.

Python harnesses both in this model, is a paradigm Controller in an
MVC setup, with OpenGL and/or POV-Ray providing the views.  The models
might literally be Polyhedra, expressed mainly as data structures
(faces as lists of vectors for example).

In this Saturday Academy course, students get positive reinforcement
for learning linear algebra's vector mathematics in the context of
working out on two kinds of graphical engine, but with one lexical API
in common, our expressive snake language.

Eyeballing viztoyz, several students immediately seized on color as
something they could get a handle on.  This led to an exploration of
the VPython documentation online, to assigning (r, g, b) 3-tuples,
which one student
wanted to generate randomly as well, as in

def randcolor():
   return tupe( [ 0.01 * randint(0,100) for i in range(3)] )

or whatever.

The size of the "XYZ water tank" was another parameter.  Or the number of
spheres, the number of cylinders.  Start with simple tweaks.  Get down your
import/reload reflexes in IDLE.  Yes, sometimes we need to kill our shell,
maybe Ctrl-Alt-Del to the task manager, hunt for ghost snakes under processes.
Not saying it'd be just the same in a Linux lab.  YMMV.

Anyway their regular math teachers should be happy.  This is very traditional
stuff that we're pushing.  Yet having a lexical computer language
talking to graphical engines (sound engines ahead) makes a really huge
difference.

We give students a more motivating context in gnu math -- assuming for
example that they might want to someday work in Portland's emerging
ToonTown economy (quite a live possibility for students living around
here).  I'm thinking this approach
is likely to catch on in places other than just China.

Kirby


More information about the Edu-sig mailing list