Tuesday, September 18, 2007

Christmas Present Idea

Long have I pined for a mechanical watch where you could actually see the gears and springs and whatnot flying around. I've seen things like this with the "Fossil" brand attached, but they are always less than what I really wanted. I tried googling for "mechanical watch with visible gears" but that wasn't too helpful.

Today I discovered the magic word: Skeleton. A "skeleton" watch is one where it is purposely made to be see-through. "Full skeleton" means that even things that you'd kind of like to have on a watch, like numbers and hands, are as tiny and hard to use as possible so you can see the full glory of the gears.

Feast your image display software on THIS:

I gather it is possible to spend up to and including ONE MILLION DOLLARS on a watch like this, but, I further gather, Chinese imports can be had for under \$100. Even well under \$100. For instance.

I wouldn't have many requirements on such a gift. It should be as visible as possible and be actually mechanical, no hidden battery doing the work.

Monday, September 17, 2007

A New Recipe for π

I've been working on a Difference Engine in Lego. A little derivative perhaps, but still a big challenge. For one thing, there's not that much construction detail at that site. For another, what little there is I'm ignoring. I want to try to solve this on my own.

I've made some progress, but my (borrowed) video camera is being cranky so I've been unable to record and post it. (Aside to person I borrowed it from: I'm just getting a black screen in record mode. Also a little red flashing light that I think is the button battery so I thought that was it. However recording suddenly started work despite that, but only for a few minutes. ???) Thus this post isn't about that.

When the Difference Engine actually is running, I thought it would be fun to have it calculate π. NO WAIT, LET ME FINISH!!! I know π is transcendental, meaning there is no polynomial for which π is the solution.

The point of the Difference Engine is that as you crank the handle, you calculate the value of the polynomial for higher and higher values of x. What I'd like is a polynomial such that for higher and higher x, the value is closer and closer to π.

So I just google for a polynomial that does that, right? I mean, there must be hundreds of them by now. No. There are none that I can find.

There are plenty of series approximations, however. For instance:

π = 1/1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 +....

And with some series...es, it's possible to come up with an expression that the series sums to up to any given point. For instance, the sum of the first n odd numbers:

1 + 3 + 5 + 7 + .... 2n-1 = n2

So maybe one of the series approximations of π can be manipulated into a polynomial. Then I can use the Lego Difference Engine on that polynomial and crank out 2 or 3 digits.

However, I'm having a great deal of trouble with this (not that that indicates anything other than the fact that I'm really not that great at math). For one thing, I've concentrated my efforts on the simple-to-remember 1/1 - 1/3 + 1/5 approach. But I just realized this morning that this series alternately overshoots and undershoots the target, meaning it has an infinite number of humps and valleys. A polynomial of degree n can have a maximum of n-1 humps and valleys, AFAIK, so that series is out.

If I'm going to start from a series, I need one that's always more or less than π and never the other. Or an entirely different idea. I can think of plenty of iterative methods, but that's basically just a series. I need a single step where the accuracy is chosen by the value of x I input. Since I haven't been able to find any reference to such a thing, I'm thinking it hasn't ever been done. Is that because it's impossible?

Tuesday, September 11, 2007

You Program My Back, I'll Program Yours

If you are a math/science/computer nerd and you have a child, you have undoubtedly wondered how you can teach your child programming. I googled for such a thing more than once and found the usual suspects: BASIC, LOGO, etc, etc. The free ones were all half-finished or too hard, the good ones were all expensive or geared towards classrooms.

I tried teaching Number One Son (8 years old) some pseudo-codey stuff to do simple math problems and learn about loops. He enjoyed that, but we didn't get very far and I always had to be the virtual machine to check if his program ran.

However, MIT has recently come up with something that absolutely rules--Scratch. And it's free!

Scratch is graphical. You drag the little components around to assemble a program. For instance, to make a loop, you drag your components into a loop widget, which wraps around it like a vice. If you want to construct a conditional, you get out the "if" widget and drag and drop logical/mathematical conditions in from the toolbox. Just fill in the blanks and go.

The GUI isn't just for show, either. You don't feel like you are using the mouse to write a program, you feel like you are literally assembling a physical object. And it eliminates syntax errors, which is a major deal in the under-13 crowd. Furthermore, the graphical programming language ties right in to the very graphics-oriented programs Scratch is targeted towards and children love. Creating and animating sprites takes just a few clicks. Object collision is just a matter of checking if two colors are touching. And this is all clearly presented enough that an 8 year old can (and has) figured most of it out himself.

I think he learned more about programming in 2 days with Scratch than he did in all the previous years of my bumbling explanations. He goes off and works on a program for a while and then will come to me with a question about how to do something. And they are pretty sophisticated problems (considering his age), such as how to cycle through sprite costumes and wraparound at the end or how to keep various sprites in sync. With the concrete example of his non-working program providing the motivation, the explanations of modular arithmetic or semaphores stick much better.

So far he's created programs that simulate a robot in a maze, animate a rocket flying to the moon, teach the alphabet to his two-year-old sibling and even one generic drawing program with adjustable pen size and color. All 100% on his own.

Windows and Mac only, but:

1. They claim they'll have a Linux version out "before the end of 2007".
2. The usefulness, fun and polish of Scratch is more than worth setting up an old PC with Windows.
It's possible to upload your program to share with other kids, but we haven't tried that yet. Videos of Scratch in action..

Tuesday, September 4, 2007

Lego Marble Pump II: Handcranked Bugaloo

The basic idea behind the Lego marble pump is working. I cobbled it together well enough to demonstrate My Vision, but many kinks remain to be worked out. For instance, the little levers need to be worked automatically. But I'm not going to do that, I'm just going to post the video of it hobbling along.

In case that isn't clear:

1. Marble goes in ramp at left
2. Cam on central carriage hits lever to open gate, allowing marble into carriage (part of cam played by my finger)
3. Central carriage lifts, eventually dumping marble into next higher ramp (another "cam" lifts lever there to make sure gate is closed)
4. Central carriage lowers, goto 2