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?

1 comment:

  1. Aha, this is impossible and I just figured out why.

    I'm looking for a polynomial that asymptotically approaches π. But a polynomial can't asymptotically approach anything. If it has an odd degree (x^3, etc), then for any y I choose, I can find an x such that f(x) > y. If it has an even degree, then it will have some maximum value and then drop away. (Difference in degrees because of the different numbers of bumps and valleys.)

    This is less than rigorous, but I'm pretty sure the basic idea is right.

    ReplyDelete