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.

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 »
Leave a Comment » |
algorithms, Mathematics, theoretical computer science | Tagged: Fibonacci, mitosis, Rabbits, rewrite systems |
Permalink
Posted by Steven Pigeon
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.

Taking a break, I accidentally a trébuchet.
Read the rest of this entry »
Leave a Comment » |
LEGO | Tagged: catapult, counterweight, LEGO, machine, mechanical prototype, medieval siege engine, siege, trébuchet |
Permalink
Posted by Steven Pigeon
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.

We’ll see the formulas, and how to select “nice” parameters.
Read the rest of this entry »
Leave a Comment » |
Mathematics | Tagged: 2 pi, cosine, Lissajous, Lissajous curves, paramteric curve, Pi, Sine |
Permalink
Posted by Steven Pigeon
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,
.

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 »
Leave a Comment » |
algorithms, C-plus-plus, hacks, Mathematics | Tagged: asymptotic series, error, Factorial, factorial function, Mathematica, numerical analysis, Stirling, Stirling's series |
Permalink
Posted by Steven Pigeon
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.

Read the rest of this entry »
6 Comments |
C, C-plus-plus, hacks, Uncategorized | Tagged: assembly language, code generation, g++, recursion, tail recursion, wat |
Permalink
Posted by Steven Pigeon
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.

Read the rest of this entry »
2 Comments |
algorithms, data compression, hacks | Tagged: Blackman, Blackman filter, Color Space, colorspace, Compression Ratio, DCT, JPEG, rgb, subsampling, ycrcb |
Permalink
Posted by Steven Pigeon
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.

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 »
3 Comments |
algorithms, data compression | Tagged: Cats, colorspace, gaussian blur, psychovisual, ycrcb |
Permalink
Posted by Steven Pigeon
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

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 »
3 Comments |
algorithms, data compression, Data Visualization | Tagged: colorspace, HSL, psychoacoustics, psychovisual, rgb, ycrcb |
Permalink
Posted by Steven Pigeon
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.

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 »
2 Comments |
Bash (Shell), hacks | Tagged: Bluetooth, Keyboard, wireless keyboard |
Permalink
Posted by Steven Pigeon