Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dynamic graphs



Hello:

Two months ago at the Cambridge Brewing Co. after a Blu meeting, I had
lamented that I wanted a program to make dynamic graphs of the complex
plane (OK, it was a strange lament, but I'm like that).  The only
dynamics graphs I have seen are on oscilloscopes.  In all math books,
the graphs are static, even ones with time as an axis.  I thought a
better representation of time would involve animations.  Think of
scanning, line by line, a graph to generate an animation.  That was
the goal.

Several people made proposals on how to get this sort of thing done.
I went with Jabber's idea of using the GD library which works well
with Perl, my language of choice.  I wanted to make the program
command line friendly, because I think the model of small programs
that can be combined in a various ways has proven its worth.  It also
would make writing a cgi script for a web interface direct, should
that day ever happen.

There are four programs in this alpha-ware set.  "dg" creates dynamic
graphs if fed real, complex, or quaternion numbers. Quaternions are a
set of four numbers that can be added, subtracted, multiplied or
divided, like the complex numbers.  Three complex numbers actually
make up one quaternion, with the three complex numbers all sharing the
same real number.  If that shared real number is viewed as time, and
the three imaginary numbers as x, y, and z, a dynamic graph of a
quaternion function may look like a 3D animation.  The png format is
used for static summaries, mng for animations which can only bee seen
with Mozilla-based browsers, ie not IE.  "ug" work with unary
functions like sine and cosine to generate lots of quaternions that dg
can graph.  "bsg" takes numbers from both STDIN and ARGV so the binary
stream of numbers going into addition or multiplication functions can
generate a bunch of quaternions for dg to graph.  The module Qlib.pm
does the quaternion math.

The output of these programs has been fascinating.  Even my girlfriend
is interested which is exceptionally rare in the obscure math I do for
fun, no profit.  I have put together a WimpyPoint presentation here:

        http://sdm.openacs.org/wp/display/1238/

My favorite insight was with the sine function.  We all know it has to
do with the circle.  The long line of camel humps of the standard
graph of the sine function doesn't visually say "circle".  The reason
is that the domain is graphed against the range.  With dynamic graphs,
it is possible to graph the domain and the range separately.  The
domain is linear, and thus dull to watch: it either remains still or
moves like a steady snail.  The range when sine is applied to the
steady snail looks like a bunch of circles.  This is in 3D, so there
is tilt, roll, and yawl, but there are circles none-the-less.

How does cosine differ?  Cosine is an even function around time.
Events appear in the animation in pairs.  Sine is an odd function
around time, so its animation feels syncopated.

At this point, I am not sure if the slides are enough to explain this
work, or whether I need to be there to explain these graphs (if you
visit, please tell me).  If you want to look at the code, a gzipped
tarball is available for download here:

wget http://theworld.com/~sweetser/quaternions/qemation/dg_tools.tz

Although still alpha, it does have -help and perldoc documentation,
and "grep # program" will list all the comments.


doug




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org