Archive for the 'java' Category

7/52: Mathematical exorcism - Quaternions, higher dimensions, fuera!

Thursday, April 10th, 2008

“Oh dear! Oh dear! I shall be too late!”

– The White Rabbit, Alice in Wonderland

And I am late, in a few ways. But join me in my rabbit-hole.

This is an exorcism of sorts. I found out the answer to a little question that was knocking around my brain for, oh, around 15 years…

Around 1987 I read a book called Chaos by James Gleick. This was something like a formative experience: being shown, in words and pictures, the strange ways nature (as well as man-made systems) could act: simple rules producing complex, “unpredictable” seeming behaviour; nature being self-similar on many levels (i.e. fractal); the way that order hides with disorder, and vice versa… The book also covers some of the interesting characters and situations around the emergence of Chaos theory.

One of many mad illustrations in the book caught my eye. It was a computer-generated picture showing a sort of colourful square divided into four colours, four segments, like a pie. But this psychedelically demented pie was odd: between two any two colours on it, the other two colours interposed themselves. Ad nauseam. Here’s that diagram, which I’ve recreated:

Newton-Raphson 'pie' diagram for solutions to z^4 = 1

[click image to see more on my flickr site]

This fractal diagram is borne of a certain question concerning complex numbers. I am sometimes perversely interested in higher dimensions and strange mathemagical things, so when I found out years ago that there was a higher dimensional extension to the complex numbers called Quaternions, I wondered how the above picture would extend in these higher dimensions - would it be particularly interested or mad?

In order to find out the answer, I wrote a visualisation tool in Processing that pretty much told me the answer… (Download processing script - zip file, 16K).

Then I went and looked at the mathematics behind Quaternions, and found out that the answer I was seeing in the visualisation was correct.

They say one of the best ways to make sure you have understood something is to explain it to someone else - so with that in mind, I’ve written up the full gory details of the ‘answer’ on the create52 cookbook.

(Note on quaternions: The Quaternions are a number system that can describe rotations (in 2, 3 and 4 dimensions), and they are an extension of Complex numbers. Like a lot of things that bear some sort of fruit in mathematics, the Quaternions were originally considered “mathematically pathalogical” (what a term).)

As penance for being somewhat lazy with getting this one out, I intend to do something with some utility next. Gawsh. Possibly something faceboot related, but actually useful with it…

6/52: Typography toy

Friday, February 15th, 2008

I wanted to start on a software tool for playing with typography (text) in a casual, bullying sort of way. Hence this typography toy, which I have stopped fiddling with now…

There’s a set on flickr of random pics I made with it. It’s more fun to play with it than look at the results, though…

It’s written in Processing again. It’s downloadable via the following links:

  • Windows: download (approx 300K. Java must be installed on your system.)
  • Mac OS X (and possibly earlier versions): download (approx 300K)
  • Linux: download (approx 300K)

The Processing source code is included with each download. If you download it, please read the readme.txt file - or else you’ll probably just scratch your head and go “whaaaa?” before resorting to a life of crime….

Again I’m reminded that Processing isn’t the most natural seeming choice for software where you need some sort of complex interface: it doesn’t seem to come with the ability to add buttons etc. to your UI (although you can implement them yourself - doh!) - hence the large amount of key presses possible to control this thing. Of course, with some effort, a nicer interface is well possible…

“Typography” probably isn’t an accurate word for what this thing is - but somewhere a man is being eaten by a gruffalo, and that is much more important, don’t you think?

5/52: Million point sculptures: interactive toy written in Processing

Thursday, January 24th, 2008

A while ago I played with some mathemagical things called Million Point Sculptures. I was wanting to go back to these some day, so I’ve used a programming/visualization/interaction environment called Processing to make an interactive Million Point Sculpture toy. I added a few things like colours and weirdo line mode and I love some of the results…

Sadly I can’t post the Processing interactive applet currently due to browser/haircut issues (that is coming shortly), but for now have some images that came out of the applet I made…

The full set is at http://flickr.com/photos/redlex/sets/72157603786503565/