Why 22/7 is a better π day than 3.14

March 15, 2013

Apart from poking gentle fun at date ordering, i do have mathematical reasons to like 22/7 more. As i mentioned in a follow up tweet, 22/7 is a better approximation to π than 3.14 in an absolute sense – 22/7 is within 0.0013 of π, whereas 3.14 differs from π by just under 0.0016. I am swimming against the tide though – even Wikipedia calls 22/7 Pi Approximation Day, reserving Pi Day for the less accurate 3.14.

However, it was a reply from a friend pointing me at All Rational Approximations of Pi Are Useless which spurred me to action, in as much as blogging is action. Apart from the fact the provocative title is demonstrably false – i use a rational approximation of π (typically 3) all the time to estimate the volume of cake tins amongst other things, that article really deserves critiquing. The claim is that rational approximations are useless because they are no better than remembering decimal digits. Already we can see this depends on what you mean by better – 22/7 is better than 3.14 for the same number of digits, if by better you mean “closer in absolute value”. Ah, but his version of better is “correct digits when expanded in base 10″ – in other words – a definition skewed towards base 10!

Let’s think it through a bit more – in base 10, we have 3.14 = 3 + 1/10 + 4/100, whereas π = 3 + 1/10 + 4/100 + 1/1000 + 5/10000 + …

So what is a fair comparison for 22/7 ? Surely its base 7! Here, 22/7 = 3 + 1/7, whereas π = 3 + 1/7 + 0/49 + 0/343 – 3/2041 + … . The denominators here are the powers of 7, and i’ll allowed myself “negative digits” to make clear how close the value is. So in fact, 22/7 gets three fractional base 7 digits right, for only one fractional part (1/7). The approximation 3.14 needed two fractional parts (1/10 and 4/100) to get, umm, 2 digits right … hopeless!

Another way to think about how good a rational approximation p/q is to an irrational a is to look at the absolute difference between p/q and a as a power of q. In symbols, find k so that |p/q – a| < 1/qk. One way to think about this is that this is what matching to k places base q means. Another way to think about it is that for any q you can get within 1/2q of a just by picking the p that makes p/q closest. It’s only for special q that you can do better. How does 22/7 do ? Well, the absolute difference between 22/7 and π is about 7 to the power 3.4 – which accords with our 3 digits right above. There are other great appromxiations, for example 333/106 gives just over 2 by this measure, and 355/113 gives 3.2 by this measure.

Back to the article – the author finds 355/106 by brute force, and then searches to 10,000 to no avail. There’s a good reason for that – the next great rational approximation of π is 103993/33102. Of course, the way to find these is not brute force, but by thinking. That is to say, by doing maths – specifically the theory of continued fractions. His brute force technique finds 99/70 as an approximation to √2 – again, this value is predicted by the theory of continued fractions – it takes about under 60 seconds of hand computation to find it once you have the theory – no need to throw the massive computation engine of Mathematica against a problem which has an elegant and well understood theory behind it.

A mathematician and friend who will remain nameless for now once suggested to me that Kepler would not have made his ground breaking work in planetary motion if he had had access to Mathematica. At the time, planetary motion was predicted via epicycles, an approximation technique. The claim is that it was the difficulty in getting better approximations via epicycles – the calculation just gets too hard – that drove Kepler to look for, and find, a correct theoretical solution that was also elegant and practical for computation. Had humanity had a computation engine capable of computing epicycles, it might have been generations before his inventions were made in the absence of their mother necessity.

Postscript

I want to leave it there, but feel i must observe that i’m not against machine computation – far from it – computers have enabled fantastic progress and contributed significantly to human wellbeing. However, i do have a sympathy for the point of view that being required to find a theoretical solution in order to make practical progress can lead to discoveries that you miss if you’re overly focused on answers because you can find them easily. It’s the journey, not the destination.

First thoughts on a Kindle

February 5, 2011

I used to read a lot. My mother recounts that as a child, she would take me and a book shopping, park me on a couch in the department store with my book, and return after shopping to find me exactly as she left me with the exception of some turned pages. My earliest loves were fantasy (Tolkien of course, but also David Eddings, Raymond E. Feist and Anne McCaffery among others), although i also read science fiction. After a long swing though horror in my late teens / early twenties (Steven King and Clive Barker figure prominently here), i really settled into mostly reading science fiction (Iain M. Banks, Greg Bear, Greg Egan and Peter F. Hamilton among others).

I drifted away from reading somewhat in the last decade – busy with work, homemaking, and later a baby / toddler / preschooler. I still consumed my favourite (Banks) greedily, but was reading less new fiction. First podcasts, and then twitter filled my commute time where once i’d’ve read. More than this, i just lost track of making the time to read.

For my birthday, the wonderful @ms_miff gave me a kindle – the 6″ 3G+WiFi version. This was in consultation – i’d realised i wanted to read more again, and had started buying / borrowing / rediscovering some books, as well as trying reading on my iPhone screen, which i found hard on the eyes. I decided on a small, fit for purpose e-reader rather than the obvious tablet.

Why ?

That’s hard to answer. So, instead, i’ll say what i think of the kindle after reading my first full e-book on it. Some of this I expected to be true, and answers the why, and some may be helpful if you’re asking the same question. And some will just be post-hoc justification.

Firstly, the screen is amazing. If you’ve not looked at an e-ink reader, do so before thinking you want to read off a backlit screen. When i unwrapped it on my birthday morning, i saw the screen had a lovely greyscale design on it. I promptly tried to remove the overlay – assuming it was one of those “stuck on for shipping” stickers. It wasn’t – it was the screen showing a static image. As i understand it, the resolution isn’t that much greater than a 3G/3GS era iPhone, but the high contrast reflective screen makes it look immensely better. The refresh is odd at first (a kind of inverted video flash), but it’s fast enough (at least on the newest model) that it doesn’t interfere with reading (at my speed anyway).

The small size still fits enough text to make reading pleasant (it’s a bit like a smallish paperback) even at the slightly enlarged font size i use. It’s light enough to carry one handed easily, which means i can read it while walking – my morning commute often involves a 30-40 minute walk. It also means it can be always in my bag, which assists in having it when i have a spare moment to read. This last point is actually critical to displacing the iPhone as my time sink of choice. I’m not sure how a larger kindle, or tablet, would fare here. Battery life also matters on this point – i’ve had the kindle for a week now and read a book, and it’s used about one third of the first battery charge. This means its always ready to go when i have spare moments to dive into a book, without me needing to remember to charge it daily.

I’ve not yet got a case – i stick it in a \$1.10 Australia Post Pb2 padded bag for protection in my backpack. It fits nicely in this, but this does go to one of my concerns – i’m not really sure how hardy it is, and obviously don’t want to find out through catastrophic failure! Ergonomically, it’s hard to “grab”. It’s nice to hold when you’re reading, but when you’re trying to fish it out of a bag or grasp it while shouldering a back pack, its not clear where you can apply pressure. I’ve taken to grabbing it by the keyboard.

Which brings me to my only negative – the keyboard. In a post iPhone world, i thought i would want a touchscreen. I don’t miss that at all – the page turn buttons work fine, and on the rare occasion i use the joypad to navigate a menu it’s not a big deal. I actually try to avoid touching the screen so i don’t have to clean it – i want to read off it after all! No, the keyboard is a negative because, for my usage, the device doesn’t need one. i’d rather have more screen, or a smaller device. So far, i have used it twice – to enter my amazon credentials and my home WiFi key. I’d happily have done both of these via a USB connection. I don’t search for books on it, i do that on a PC and wishlist them, at which point they’re only a few clicks away on the kindle. Or, i expect, i’ll buy amazon recommendations – again, a few clicks away. Maybe i’ll change my tune on this, but for now, it’s the only minus i’ve found in the kindle experience. In an ideal world, my WiFi capable iPhone could act as a keyboard for the Kindle, but that’s a level of integration that is, unfortunately, probably a pipe dream.

In summary, after one book, i love it. I bought a book i’d never heard of via links from a favourite author and checking half a dozen reviews. The book was in my hands a few minutes later, and i read it over the next week. I’ve now queued nine items on my wishlist, and look forward to reading them the same way. Reading on the kindle is, in almost all respects, at least as, if not more, pleasant than reading a physical book. It’s smaller and lighter than most paperbacks, the screen is like paper, but resizable for my below average eyesight. I can carry it everywhere and read when i please. It’s not as robust or cheap as paper – but you can’t have everything.

On a final note, i received a second kindle related birthday present – a kindle book from my oldest friend. This was a real “welcome to the future moment” – while chatting with him online, an email arrived, and a few clicks later my present arrived on my kindle. I’ve yet to start that book, but, in fact, i’m going to go start it now …

My first Sourdough

April 11, 2010

I’ve done a fair bit of cooking in my time, including bread. However, all the bread i’d cooked was with commercial yeast – some using a bread machine, some by hand. I occasionally got a bit fancy – doing plaits for example – but had never tried making sourdough. I’d read various introductions on how to do it, but always been scared off by either the seeming randomness or presumed skill – how can i be sure that smells “pleasantly fruity” ?

However, of late, i’ve been afflicted by a mild professional ennui – it happens from time to time – and found myself getting more interested in matters of the hearth. This post is not the place to go into a lot of detail on the reasons, although i will say that reading Stephanie Alexander‘s Kitchen Garden Companion played a large part in kindling an interest in gardening and the raw materials used when i cook.

So, it was on this fertile soil that the seeds sown by various people on twitter landed. My few attempts to garden in our small terrace courtyard have met with mixed success. Growing a sour dough leaven tickled a similar nerve, but seemed easier, and not to mention quicker. I also came across SourDom’s instructions for making a starter, which, for whatever reason, sounded accessible in a way others hadn’t. So, at the end of March, i began following the instructions. On Easter Sunday evening it staged an escape attempt, and by the end of that week it was rising well when fed, and i figured it was time to cook.

The recipe i settled on was Norwich Sourdough. Why ? Firstly, it used a 100% hydration starter, which is what i had to hand. Secondly, it could be done in a day once i had ripe starter. Finally, the instructions were quite precise in quantities and times – when i start cooking, i like this until i get the feel of what it’s supposed to look and feel like. Of course, there are probably hundreds of recipes with these three properties, this is just the one i found. I made a half quantity, as that neatly matched one ripe load of leaven, and varied the times a bit because my loaves seemed a bit bigger – i think i ended up with 15 minutes of steam and 20 minutes without.

I was very happy with the result – straight from the oven, and when cut. Megan and Griffin also approved – in fact we ate the smaller loaf in its entirety yesterday, and the larger one is pretty much down to just a couple of ends now. I’m very keen to try again – i’d like to do the same recipe a few times in a row to learn the variation, but we’ve got some busy weekends coming up which will preclude a day spent cooking for a while. However, i’m also interested trying @tammoisovernight recipe, but i’m not sure about my judgement for the quantities.

Where to start ?

April 11, 2010

Too many times, myself or others have advised me to get a blog, usually in order to quarantine a rant about something.

Finally, i’ve decided to do something about it. Expect to find sundry rants here, on the varying topics which occupy my time and energy.

That could mean a lot of things:

You can also find me on twitter.