Fibonacci rabbits as a rewrite system

23/12/2014

In my discrete mathematics class, I often use the Fibonacci rabbits example, here to show how to resolve a recurrence, there a variant where some rabbits go away, here again for rewrite systems.

fibolapin-bw

What are rewrite systems? Not unlike context-free grammars, they provide rules generate “words” in a “language”. Turns out the Fibonacci rabbit population problem is super-easy to model as a rewrite system.

Read the rest of this entry »


Trébuchet!

16/12/2014

Lately, a side research project asked me to devise a mechanical prototype, something I haven’t done in quite awhile. But to the difference that it asked for gears, motors, and all that. Turns out that LEGO is a good way to prototype these things.

Trebuchet

Taking a break, I accidentally a trébuchet.

Read the rest of this entry »


Lissajous Curves.

09/12/2014

Many of this blog’s entries seem … random and unconnected. This is another one, despite it being quite connected to some research I’m presently conducting. This week, we discuss Lissajous curves.

lissajous

We’ll see the formulas, and how to select “nice” parameters.

Read the rest of this entry »


Stirling’s series

02/12/2014

Last week, we had a look at how g++ handles tail-recursion. Turns out it does a great job. One of the example used for testing the compiler was the factorial function, n!.

fibolapin-bw

We haven’t pointed it out, but the factorial function in last week’s example computed the factorial modulo the machine-size (unsigned) integer. But what if we want to have the best possible estimation?

Read the rest of this entry »


Of tails.

25/11/2014

In a previous post, I explored the effect of pruning on a recursive function, namely, the Collatz function. Richard (see comment) asked “does your compiler know about tail recursion?”. Well, I didn’t know for sure. Let’s find out.

tail-recursion-small

Read the rest of this entry »


No post today

18/11/2014

I’ve been insanely busy lately. So no blog entry this week.


Of Colorspaces and Image Compression (Part III)

11/11/2014

Last week, we continued on color spaces, and we showed—although handwavingly—that we’re not very good at seeing color differences in hue and saturation, and that we’re only good at seeing difference in brightness. In this last part, we’ll have a look at how JPEG exploits that for image compression.

P1131283

Read the rest of this entry »


Of Colorspaces and Image Compression (Part II)

04/11/2014

Last week we discussed briefly how we can represent color using either RGB or a colorspace that’s more easily amenable to decimation by a psychovisual model.

P1131283

This week, we’ll have a look at just how tolerant the human visual system is to color (hue/saturation) variations.

Read the rest of this entry »


Of Colorspaces and Image Compression (Part I)

28/10/2014

The art of lossy compression consists almost entirely in choosing a representation for your data in which you can easily figure out what data to destroy. That is, if you’re compressing sound, you must transform the waveform into a domain where you can apply a psychoacoustic model that will guide decimation, that is, the deletion of part of the information, part of the information that won’t be heard missing. If you’re rather compressing images—that will be our topic today—you must have a good psychovisual model that will help you choose what information to destroy in your image

P1131283

The model can be very sophisticated—and therefore computationally expensive—or merely a good approximation of what’s going on in the observers’ eyes (and mind).

But let’s start with the beginning: representing color

Read the rest of this entry »


The wireless keyboard, again (part deux)

21/10/2014

For last week’s entry, I wrote a small script to monitor my wireless keyboard’s activity, logging keys, and mode changes. This week, let’s have a look at the data we can grab, and what we can do with it.

pigeon-camera

So, after grabbing keyboard activity for a bit more than a week (from 2014-10-12 22:47:31.059636 to 2014-10-20 08:45:06.733120), we’re ready to preprocess the logs and extract useful information.

Read the rest of this entry »