Monday, November 19, 2012

Emacs 24 and imap

I upgraded to emacs 24 from emacs 23. I had a problem with gnus and getting mail via imap, which I couldn't immediately find a solution to via the usual mechanism of googling the error message.

It turns out that changing the value of gnus-secondary-select-methods from:
((nnimap "mail"))
to

((nnimap "mail"
(nnimap-stream network)))

did the trick.

Monday, November 12, 2012

Running with Raynaud's

I have problem with circulation in my fingers which means that they can get very cold rather easily. This is a condition known as Raynaud's syndrome. As the pictures in the wikipedia article shows it can look rather alarming when all the blood goes from your fingers.

During long runs in the winter it can be difficult to get warmth back into your fingers once they get cold, so the key to avoiding problems is ensuring that they things do not get to that point in the first place. Having had a couple of nasty cold-finger experiences whilst out on long runs, I have now figured out how to avoid problems. Shorter runs are less of a problem - since you will be home soon and can immerse your hands in a bowl of warm water, which always works for me to get things warm again.

Keeping your whole body warm is important. When it is cold I wear running tights. If it's very cold I wear shorts over my tights. I've given up trying to keep my feet dry, but nevertheless I find that they stay a little warmer with good quality wool hiking socks. Your shirt should have long sleeves - keeping your arms as well as your hands warm is important. Normally I wear a technical running shirt, although I find that a merino wool base layer also works well when it is particularly cold. A running jacket is fine in most weathers, it acts as a wind-break and helps to keep you warm. When it is very wet a good quality goretex hiking jacket is preferable. Significantly heavier, but will prevent you coming soaked through when it's raining heavily. I take two hats - a synthetic beanie style hat for warmth and a peaked hat to keep the rain out of my eyes. Finally I take two pairs of gloves, thing synthetic or merino base layer gloves under wool or synthetic mittens.

That's a lot of clobber, but you don't have to wear it all - just have it with you in case you need it. Gloves and hats can go in a jacket pocket or be tucked into the waistband of your tights or shorts. The jacket itself can be tied around your waist.

I have noticed that if I wear a watch the hand with the watch can get colder than the other hand. To avoid this do not strap the watch directly onto your skin. Put it over the sleeve of your shirt or else the cuff of a glove. Do not tighten the watch strap excessively - keep it as lose as you can bear. Alternatively just put the watch in a pocket or leave it behind. I like to have mine with me as it's also a gps unit that records my route and pace and so forth.

Be warm and properly dressed before you step out of the door. If it's cold, wet and windy your fingers can get cold very quickly - spending a couple of minutes with bare hands whilst you tie shoelaces or fiddle with your GPS can be a real problem, so make sure you're set to run as soon as you leave the warmth of the house. Similarly, if you feel cold before you set out on your run take time to get warm before you leave.

On longer runs take something to eat - running low on fuel can exacerbate problem with keeping warm.

Some of this advice might seem over the top - but if you've experienced the problem of all the blood leaving your fingers when it very cold, wet and windy and you are miles from home then you seem come to appreciate the value of avoiding the problem.

Thursday, November 1, 2012

Cantor's diagonal argument.

I wrote an article about this following a discussion with a friend and my kids, but I seem to have lost it so I am writing it again.

Cantor's diagonal argument is a neat piece of mathematics that is very easy to understand, and important in understanding how to deal with counting things that are not finite.

The counting (or natural) numbers are the numbers we use to count things in the real world: \(1, 2, 3, \dots\) In this article we will exclude zero from the counting numbers, but nothing essential changes if you chose to include it.

The counting numbers provide answers to questions "how many \(x\) are there?" for any finite \(x\). What does "finite" mean? It means that given some collection of things, if we had enough time we could count them all using the counting numbers. Of course there are large finite numbers for which it is impractical to actually perform the counting - we'd die before we had finished, but that is a detail that isn't important.

Note that there are a few important characteristics of  performing a count. Firstly we start at one, and use the numbers in sequence; we only use each number at most once, and we only count each item once. Another way of thinking about this is that we provide a one-to-one correspondence between all of the counting numbers up to some maximum, and the collection of items to be counted. That is - we have a rule that allows us, in theory at least, to uniquely identify a counted item from one of the counting numbers below the maximum, and also to uniquely identify a counting number given one of the counted items.

To help us along the way in that which follows I'll use a bit of jargon. The size of any collection of items is called its "cardinality". For finite collections the cardinality is simply the size of the collection, that is: the counting number that we get to when we perform a count. Clearly when the cardinality of some collection is given by some counting number, say \(n\), then it is a finite collection. Its size is given by a specific, finite, counting number.

So far, so good. What happens if we try to count something that is not finite? For example the counting numbers themselves. Clearly we have a problem - for any counting number there is a bigger one - we can just add one to it. If we try to perform a count we will never get to the end, however much time we allow. However we can make a one-to-one correspondence with the counting numbers and themselves, if we forget about the "up to some maximum" bit in the previous paragraph. In a sense this is pointless - we're answering the question "how many counting numbers are there?" by saying: "the same as the number of counting numbers", so we have not made progress. But we can at least give this a name, and  ask whether other infinite collections have the same cardinality. The traditional name for the cardinality of the counting numbers is \(\aleph_0\). (\(\aleph\), or "Aleph" is the first letter of the Hebrew alphabet.)

One thing that is clear is that the cardinality \(\aleph_0\) is a different thing that a cardinality of \(n\) for any counting number \(n\), in other words the cardinality of counting numbers is not finite.

Let us consider a couple of other sets that are clearly infinite. The even counting numbers are clearly infinite. For any even counting number we can simply add two - so any attempt to assign a finite cardinality to the even counting numbers is doomed to failure. So instead let us think about establishing a one-to-one correspondence between the even counting numbers and the counting numbers. The obvious thing is to double going one way and to halve going the other. This fits well with our description of a one-to-one correspondence. Every counting number \(n\) uniquely determines an even counting number \(2n\) and every even counting number \(2m\) uniquely determines a counting number \(m\). So we can say that the cardinality of the even counting numbers is \(\aleph_0\) - in other words it is the same as the cardinality of the counting numbers.

But wait! Obviously there are "more" counting numbers than there are even counting numbers, I hear you say... are there not? Clearly \(1\) is a counting number but it is not an even counting number. The trouble here is that intuition about finite collections does not always work exactly as we might expect when we are dealing with infinities.

Part of the problem is that we are so used to our traditional names for the counting numbers that the labels have assumed more importance that they really warrant. Suppose you are learning a new language (forgive the apparent non sequiter things will become clear shortly). You learn that the word for one is "un", for two is "deux", for three: "trois" and so on. So you can count things in your newly learned language by the usual method of assigning counting numbers in sequence uniquely to each member of the collection that you are counting. You have done this with a few collections and establish the the cardinality of collection A is "trois" and of collection B is "un" for example.  But then you are informed that the textbook you were using to learn your new language is in error - "trois" is actually the translation of the number 6, "un" is the translation of the number 2. But has anything essentially changed about the cardinality of the sets? Not really. As far as establishing cardinality goes the only thing that really matters is a one-to-one correspondence with the counting numbers (or any other set equipped with a starting point and a way of getting a new successor from each subsequent element).

So if you can accept this we can go on to figure out that there are lots of subsets of the counting numbers that have the same cardinality - \(\aleph_0\). There are some supersets that have the same cardinality. Consider the set of positive and negative integers (including zero). As well as the counting numbers we have their negations. But we can still make a one-to-one correspondence with the counting numbers. For example for any counting number \(n\) go to \(\frac{-1^n . n}2\) rounding the division towards zero. To go the other way for even numbers simply double and for odd numbers multiply by \(-2\) and subtract \(1\). So the integers have the same cardinality as the counting numbers.

It turns out that the rational numbers also have the same cardinality as the counting numbers. I will not spell out all the details here, but to give you a flavour of how it works - consider the positive rational (nothing essential changes if we include negative ones two), arranged in a series of rows - the first row contains all the rationals with 1 as a denominator, the second with two as a denominator and so on. We then start counting in the top left corner of our grid and proceed down the diagonal immediately adjacent to this, then up the next diagonal, down the following one and so on. Some of the numbers we come across will simplify to ones we have already encountered - we simply skip them when counting. It should be clear that this process gives us a one-to-one correspondence with the counting numbers.

At this point we might start to wonder whether there is any infinite collection of numbers that does not have cardinality \(\aleph_0\). There is a neat argument, originally due to Georg Cantor, that shows that there cannot be a one-to-one correspondence between the irrationals and the counting numbers.

To simplify things we'll just consider the irrationals between 0 and 1. If we can show that they have a larger cardinality than the counting numbers then certainly all the irrationals must be at least as large. So we can construct a list of irrationals in the order implied by this correspondence. Consider the infinite decimal expansions of each of the numbers in the list (just add zeros if need be). Now start with the first number and take the first digit, now add one to that digit modulo 10. From the second number take the second digit and do likewise and continue on through the list making a new number from the resulting digits.

By construction this number differs from each number in the list in at least one digit - therefore it is not in our list and so the assumption that our correspondence included all irrationals in the specified range is false, so there cannot be such a correspondence (since we assumed nothing about the correspondence other than its existence).

The cardinality of the irrationals is known as \(\aleph_1\), and it's a different cardinality than \(\aleph_0\) and clearly not finite. In fact it is obviously "larger" than \(\aleph_0\) - the method of construction in the argument above illustrates that there are more irrationals than counting numbers, however you try to construct a one-to-one correspondence.


5k Training

5km is a popular race distance, and here in the UK we have the excellent parkrun organisation providing free weekly 5k races at many venues around the country.

As with many things to do with running it is important to experiment. Every one is different and has strengths and weaknesses. Nevertheless there are some basic building blocks that should be present for anyone trying to run a faster 5k. Very experienced will have their own ideas about how to train, so this article is mainly aimed at people who have run a bit, but do not have a clear idea how to train.

Racing

Getting the best out of yourself takes practice, and racing is no exception. 5k is short enough that you can practice quite often without compromising your ability to train well (longer distances can be problematic - a race can take a lot out of you so you need time off to recover). The optimal strategy for a fast 5k is an even pace for about 4.5km and then to kick hard. You might need a few iterations to find the right pace. The first step is to run a race to establish a target pace. A good target is about 15 seconds faster than your recent best (this is probably too aggressive for highly trained, fast runners - but realistic for many of us). So suppose you have recently managed to run around 20:15 - then breaking 20 minutes is a good target. Obviously the average pace is 4 mins/km. However you should go out slighty slower than this. For the first 4.5km you should run at around 4:05 min/km.

The biggest mistake than inexperienced racers make is starting too quickly. Learning control in the first half of the race is an important skill.

With around 500m to go you can afford to speed up significantly. If you have been running at 4:05 min/km for 4.5km then obviously you will have taken 18:22.5 to get to that point, so you need to cover the last 500m in 1:37.5 to make 20 mins - so you need 3:15 min/km pace for that section. It's hard to get useful feedback about your pace over such a distance - so again it's a question of doing it by feel and getting used to what that pace feels like.

Consider buying some racing flats for your races if you do not already have some. But do not be tempted to use them all the time - reserve them for your races and interval work. Doing too much running in flats risks injury if you are not used to them.

Aerobic development

5k is an primarily an aerobic event, doing well relies on your heart and lungs being able to deliver plenty of oxygen, and for your legs to be able to utilise it. 

Easy running

Aerobic conditioning comes from doing lots of easy running. Easy runs should not feel hard, exact pace is unimportant. Guard against working too hard - you'll compromise your ability to put in enough miles and risk injury. As a rule of thumb you should be running no faster than 50% slower than your 5k pace. So someone running a 20 minute 5k is doing 4 min/km at race pace, therefore easy runs should be no faster than 6 min/km. But do not treat this as a target - slower is fine!

You should do as much easy running as you can make time for; but do not increase mileage suddenly - gradually build things up and listen to your body. If your legs feel very heavy then you have done too much - cut back a bit until you feel better. In any case you should have a lower volume week every 3 or 4 weeks. It is often not necessary to explicitly plan this out - for most of us real life will intervene so that  it becomes difficult to fit in your usual running from time to time.

It is good to mix up the distance of your easy runs. The minimum should be about half an hour, and the maximum about 90 minutes. If you are in training for a marathon you might do longer, but for a 5k is little point. But you can run more than once a day so long as you are not overdoing it.

Tempo runs

Once a week you should get used to running for a sustained period at a pace that is closer to your race pace. These tempo runs should consist of 15 minutes easy running to warm up, then 20 minutes at about your 10km race pace, and then 15 minutes of easy running to cool down. 10km race pace will probably be around 10 seconds per km slower than your 5k pace.

Speed development

In order to run fast your body needs to get used to running fast. For a 5k you need to spend some time running at the pace that you will in the race. There are two paces to practice. The pace for the first 4.5km, and the pace for the kick.

Strength intervals

Once a week you should do some intervals at race pace. These sessions should consist of 10-15 minutes easy running to warm up then a set of intervals that add up to about 5km - for example: 6x800m, 5x1000m or 3x1600m, followed by 10-15 minutes easy running to warm down. Walk or jog slowly between each interval for about 50% of the time it took to run the interval.

Speed intervals

Finally you should practice the speed that you need for your kick. Many inexperience runners, or even runners that have trained for longer distances are not used to running this fast. These sessions need not make up much total distance, the idea is to get used to the feeling of running at speed. So a session might look like 10-15 mins easy warm up and then 10x200m at your kick pace with 200m walk/jog recoveries or 5x400 with 300-400m walk  or slow jog recoveries.