Chaotic Rulers

November 28, 2017

I’m currently working with one of my students on a laser-based range finder. To assess the precision of the device, I needed a calibration piece. Because of the setup, the piece should look like a stair.

The piece should allow a wide range of different readings, say from 1 to 10 centimeters in known increments, say, 1cm. The naïve way of building such a piece is to build a stair with 10 steps. However, if you do it like this, the piece is wide, cumbersomely so. Is there a much better way to do so?

Read the rest of this entry »


The Middle Square Method (Generating Random Sequences VIII)

November 21, 2017

Von Neumann proposed the middle square method of generating pseudo-random numbers in 1949, in a paper published a bit later. The method is simple: you take a seed, say 4 digits long, you square it, and extract the middle 4 digits, which become the next seed. For example:

4373\to{}19123129\to{}1231.

While it seems random enough, is it?

Read the rest of this entry »


ANSI Art

November 14, 2017

Since we now have minimal ANSI support, we can use it. Of course, for cute things such as changing text color (red for error, green for OK, etc.), but that’s not very amusing. Let’s make some ANSI ART!!1!

Read the rest of this entry »


Semigraphics Compression

November 7, 2017

ANSI art and poor resolution may appeal to the nostalgic, those in want of the time when BBS were still it and the IBM PC’s programmable character set was the nec plus ultra of semigraphics, but they’re not really useful. At best, we can use them to dispense ourselves from using ncurse and still getting some colors and effects

However, “semigraphics” may have their use in lossy data compression, were we allow some data to be lost to gain some more compression. That may be especially true when we have very little computing power or if we want to have many simple CPUs in parallel doing the decoding.

Read the rest of this entry »