Pi approximation games

May 01, 2012 133 Replies

I recall the time when you couldn't consider 25.4 mm to be exactly one inch. But, they fudged enough standards so that it is now exact.

Prior to that, neither the British inch nor the American inch measures 25.4 ... and they deviated from that value in opposite direction!

S.

Even the integer-only cortex M3s we use take less than a microsecond for most things. On a 72MHz STM32F2:

Double Precision: 0.415us / 49.852 cycles /multiply 0.378us / 45.403 cycles /add 2.414us / 289.702 cycles /divide Single Precision: 0.194us / 23.350 cycles /multiply 0.250us / 30.052 cycles /add 0.610us / 73.202 cycles / divide

John Devereux

Aha, good idea, we should standardize pi to a more convenient value! :)

(Didn't they already try that?)

I suppose the american inch was bigger...

John Devereux

As a physicist I found the classic approximations

pi^2 = g pi x 10^7 seconds in a year

quite handy to within 1% slide rule accuracy

Regards, Martin Brown

Dunno what it is like now, but arctan(1) was a risky choice on some old machines as the series convergence was at its worst for that argument value and the tradeoff between accuracy and speed could cause trouble. You were at the mercy of the trig library if you did it this way.

Regards, Martin Brown

Much prettier is 98765432/8 = 12345679 (exact)

Regards, Martin Brown

It's in the eye of the beholder, but if you like that, how about

987654312/123456789 = 8

Yes, in one of those states where evolution is "just a theory", they made pi = 3 by law.

Wikipedia is often a great starting point for these sorts of things. It typically has enough information to give you some hints - but not so much that you can't have fun finding out more:

At university I remember a project that involved calculating all the digits of pi. It was written using a functional programming language (similar to Haskell) - the result was an unending list of the digits of pi. But since the language used lazy evaluation, it didn't bother calculating the entries until you tried to print them out. I used polynomial expansions of arctan() to do the sums.

So you are saying the inch is in fact metric?

Failure does not prove something is impossible, failure simply indicates you are not using the right tools... nico@nctdevpuntnl (punt=.) --------------------------------------------------------------

David Brown schrieb:

Hello,

it is known since centuries that calculating all the digits of pi is not possible. Pi has an infinite number of digits.

Bye

Are you thinking of the Indiana State legislature with their 1897 legal attempt to define Pi with a Bill inspired by some very dodgy maths.

AFAIK 3 was one of the very few values it did not "define" pi to be. See for example the original article by Greenblat in SciAM 1965, p427 or the reproduction in More Random Walks in Science (p126)

The least bad bit defined pi = sqrt(10) exactly and elsewhere as 3.2

formatting link

The worst implicit claim in the bill had pi = 4 (exactly) Says a lot about education in Indiana.

There is a spoof version about that blames Alabama.

Regards, Martin Brown

Most imperial units are defined in terms of the metric units these days. Originally they were only rough definitions (I believe an inch was variously defined as the length from a thumb joint to the end of the thumb, or alternatively as the length of three grains of barley). Then they were a bit more standardised (such as the length of a particular metal rod). But now they use specific metric definitions - so an inch is precisely 25.4 mm - and will stay that way even if the definition of a millimetre varies!

The most relevant section, "working with infinite data structures", is missing - but I hope you get the point anyway.

mvh.,

David

Which is why a 1m pendulum has a half period of ~1 second using the classic formula two pi root ell over gee or:

l g / sqrt pi * 2 *

in RPN

Cheers

Syd

That is standard fare in continued fractions. Everybody interested in these kind of approximations should take a look at this fascinating subject.

It depends. Pi has been calculated to billions of decimals. Simple floating point doesn't get you there.

Groetjes Albert

--

Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

There was a short PDP-8 assembly program that printed the digits of e forever.

John Larkin Highland Technology Inc www.highlandtechnology.com jlarkin at highlandtechnology dot com Precision electronic instrumentation Picosecond-resolution Digital Delay and Pulse generators Custom timing and laser controllers Photonics and fiberoptic TTL data links VME analog, thermocouple, LVDT, synchro, tachometer Multichannel arbitrary waveform generators

l

ng

Grin... I always just let 2*pi =3D 10, so pi =3D 5!

(and then remember there's a 1.59 floating around)

George H.

ed text -

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required