The power of natural selection

Last week I wrote a version of Richard Dawkins’s “methinks it is a weasel” program (as explained in The Blind Watchmaker). The point of the program is to demonstrate the power of cumulative selection in comparison to pure chance. Consider a random string such as “in the beginning god created the heavens and the earth”. In a purely random process, the probability of this string occurring is minuscule: with 27 letters in the alphabet (don’t forget the space!) and 54 letters in the string, the number of possible strings is 2754, or 1.97 x 1077. Your chances of hitting on this string by producing random strings are, for all practical purposes, zero.

But the situation changes once we introduce selection and cumulation. The program begins by creating a population of random strings, each 54 letters in length. None of these will be very close to the target string “in the beginning god created the heavens and the earth”. Nevertheless, some strings will match the target string in a few positions. The program evaluates each one to determine the best match. For example, the following best candidate in generation 1 (from an actual run of the program) shares 7 letters with the target string. These are underlined:

 gen 1: tashiwwsmsianhdfyf yvrrjutym bjjoig byxfpkwpkkhzfj g h
target: in the beginning god created the heavens and the earth

The program then takes this one best match and mutates it to create a new population of candidate strings. For example, each letter (in each string in the population) might be replaced with a randomly chosen letter from the alphabet with a probability of 0.09 (resulting, in this case, in around 4.8 replaced letters per string on average). This new population of strings is then again evaluated, and the best match to the target string is again retained and mutated. The mutations can be either neutral (if a non-matching letter is replaced with a non-matching letter, or if a matching letter is replaced with itself), detrimental (if a matching letter is replaced with a non-matching one) or beneficial (if a non-matching letter is replaced with a matching one).

Many generation will yield none or only small improvements — for example, when a new population of 100 strings was created based on the first generation string above, the best candidate in the second generation had gained only one matching letter (underlined) in addition to a number of neutral mutations:

 gen 2: tashiwwsmsitnhdfyfvyvrrjutym bjjoig byxfhkwpkkhzfj gth
 gen 1: tashiwwsmsianhdfyf yvrrjutym bjjoig byxfpkwpkkhzfj g h
target: in the beginning god created the heavens and the earth

This cumulative process of mutation and selection continues until each letter in the string matches the target string, at which point the program stops. Needless to say, in the beginning most mutations will be neutral. As the string approaches the target string, more and more mutations will be detrimental, or in other words, the program can take quite a number of generations towards the end to optimize the last few letters.

I would offer my own version to the internet, but it seems redundant since a nice Python version of it is already available, and it is easier to play around with the source code of the Python program than with the code of my Objective-C implementation. (On a Mac, you can run the Python version by opening a Terminal, cd-ing to the directory of the, and running: “python”.)

The main message of the program is that cumulative selection is very different from random generation. In a typical run of the program, it takes around 112 generations to select the target string. If the proverbial monkeys tapping away randomly at typewriters produced one string per second, it would take them 6 x 1069 years to explore all the possible strings of 54 letters. The equivalent selection process — also producing one string per second — would be completed after only 31 hours. Such is the power of random variation coupled with cumulation!

The program has been criticized for exaggerating the power of selection. The critics argue that the program retains correct letters permanently and does not allow them to mutate any more, which is obviously not how mutations work in nature. However, the criticism backfires, since the selection process of the program works fine even if all letters are allowed to mutate in each generation. (Note: That all letters are allowed to mutate does not mean that all letters will mutate; this depends on the mutation rate, discussed below.) Both my implementation and the Python version allow all strings to mutate: it is entirely possible for the number of differences to the target string to increase from one generation to the next, and this often happens. Nevertheless, over time the deleterious mutations are removed.

When I’ve talked about this program in my lectures, some students were concerned about a kind of cheating. They felt that the program “already knew” the target string, so that it did not mirror evolution in nature, where the outcome is unknown. Maybe there is a version of this objection that I have not considered, but generally speaking I think it misses the point. The evolved string is found by the program through a process of blind variation and selection (just as in nature); the target string is only used to determine the “fitness” of a particular letter in a particular location. This reflects actual selection processes: biological variations will also have fitness values relative to the environment in which they occur.

It is instructive to consider how variations in the parameters “mutation rate” and “population size” affect the selection process. The mutation rate, in this program, is a number between 0 and 1. It determines the probability with which an individual letter in a string is replaced during the production of a new population of strings. Trivially, a mutation rate of 0 means no mutations and thus no change in the strings over time. A mutation rate of 1 means that each letter is mutated in each generation, which amounts to the absence of cumulative selection: gains in one generation are not retained in the next. For cumulative selection to work, mutation rates have to be relatively low (try it). In my experiments, mutation rates much above 0.1 generally lead to a selection process that oscillates around a certain number of differences and does not terminate. The reason for this is clear: high mutation rates interfere with the retention of matching letters.

More surprising perhaps are variations of the population size. This variable determines how many strings are produced (and mutated) in each generation. Even though I should have known better, I expected this not to matter too much: I was thinking about the total number of variations produced, and so surely it should be immaterial whether I’m producing 300 generations x 100 strings or 3000 generations x 10 strings — the total number of strings is the same. But this is where so-called “genetic drift” becomes an issue! Consider that each generation begins with a “best candidate” string and produces a population of mutated variants of it. In a reasonably large population, there will be many neutral or detrimental variants and a few improved ones; the improved ones are then selected as the template for the next generation. However, the smaller the population size, the more probable it becomes that none of the few produced variants are improvements. It is easy to see this if you assume a population size of 1: most one-off variants of a string will not be improvements, especially in the latter parts of the selection process (when most letters already match the target). Thus, small population sizes make it possible for the string to start to “drift” randomly, simply because each generation only realizes a small sample of possible variations, most of which are neutral or detrimental.

However, the effects of population size and mutation rate interact. For instance, a mutation rate of 0.09 and a population size of 1000 will allow “in the beginning god created the heavens and the earth” to evolve. If you change the population size to 100, then the process will not terminate: it will oscillate between 10 and 15 differences or so. If you now reduce the mutation rate a bit, say to 0.05, then the process will again terminate. I leave it as an exercise for the reader to figure out the explanation of the phenomenon!

Primates and Philosophers: Read monkeys for preexistence

Darwin opened his “M” notebook in the summer of 1838, when he had already formulated the thesis of common descent but not yet the mechanism of natural selection. The “M” notebook was dedicated to “metaphysical” considerations (note well: the modern usage of “metaphysical” differs). Speaking very broadly, it explored the evolutionary history of human psychological traits. On page 128, we find Darwin’s at his most quotable:

Plato says in Phaedo that our “necessary ideas” arise from the preexistence of the soul, are not derivable from experience — read monkeys for preexistence.

Ever since Darwin it has been evident that much of our emotional and cognitive furniture must be explained by our evolutionary history. This is one of the most philosophically significant aspects of evolutionary biology, but also one of the hardest to explore empirically.

Frans de Waal’s Primates and Philosophers: How Morality Evolved is a modern continuation of Darwin’s “M” project: a reflection by a leading primate researcher on the evolutionary origins of our moral sentiments. It is tremendously enjoyable. I can give it no higher recommendation than to note that I have already ordered more books by the author. De Waal argues that the “building blocks” of human morality can be found in our primate relatives and are the results of evolutionary processes such as reciprocal altruism, kin selection and perhaps (de Waal is skeptical) group selection. This is of course not unique: The value of the book lies in its copious and lucidly presented empirical material on the morally significant behavior of primates. De Waal argues forcefully and intelligently that moral behavior is not a thin “veneer” of good behavior plastered onto a brutish, selfish psychological core. Instead, acting morally is as human (or primately) as anything.

The book also includes comments by a number of philosophers. These are not as engaging as the science (although this may reflect only my interests), but they are useful. I particularly liked Philip Kitcher’s contribution. He argues that the “veneer theory” of human morality, which de Waal attacks at length, may be a straw man: Who really believes that morality is a purely cultural layer on top of a selfish underlying biology? I suspect that de Waal needed some sort of dialectic to get going with his argument, but “veneer theory” may not be a good choice, and I rather doubt that he is being fair to those he names as exponents of the view (such as Thomas Henry Huxley and Richard Dawkins). A more productive sparring partner might be one of the following positions: (1) The assumption (which may be prevalent among philosophers) that morality is a matter of reason and not of evolved emotions; or (2) the charge that de Waal’s primate research is merely “descriptive” and so has no bearing on morality, which is understood to be “normative”.

As a separate point, Kitcher argues that it is insufficient to speak of the foundation of morality in “altruism”: different dimensions of altruism must be distinguished in order for the “building blocks” notion to be made precise. I think this is a useful conceptual clarification. It lays groundwork for the continuation of the exciting and difficult empirical project.

The elephant in the room does not get much discussion, perhaps wisely: It is the conclusion (which I find nearly inescapable, and de Waal might agree) that an understanding of our moral sentiments is all there is, or almost all there is, to understanding the foundations of ethics and morality. For now, I leave it to Hume and Ruse and Wilson to argue for this – but read also Peter Singer’s contribution to the book in hand.

I like the way it raises its family, partly birdly, partly mammaly

Ann Moyal’s book on the history of the platypus is a good read. It gives an overview of the difficulties the platypus posed for zoology and of the way it gradually came to be understood in light of evolution. Along the way, we meet many of the great figures of the history of 19th century biology – Georges Cuvier, Geoffroy Saint-Hilaire, Richard Owen, Charles Darwin, Thomas Huxley – and learn something about their scientific context. Much of this material is familiar, but it works. There are also some very nice platypus anecdotes spread throughout the book, such as Churchill’s attempts to import a platypus to Britain in the middle of the second World War (it came to be known as “Winston”).

However, something about the book irked me, and I think it relates to a broader issue in the history of science. As the etiquette for serious historians of science dictates, Moyal discusses the past entirely on its own terms. This means that we do not get much of a primer on platypus biology early on in the book, and as past scientists formulate theories about the platypus, we are rarely told whether their findings were true or not. This approach makes for a cognitively challenging read. Sometimes it would be nice just for orientation to know which early findings were true or false, why past scientists were mistaken, and how exactly they squared their (false) theories with empirical findings. Far from resulting in de-contextualized history of science, I believe that this would make it easier to appreciate the social context of scientific discovery – to understand in some detail how empirical, social and personal forces interacted. As it stands, the history is often just one thing after another, and in some sense we wind up as ignorant of the overall process as the historical actors themselves. Surely that’s not the goal of historiography.

More generally, I felt that a more distanced view would have improved the book. Much of the second half is structured around a “race” (there are shades of The Double Helix here) to determine the platypus’s mode of reproduction – oviparous, ovoviviparous, or viviparous. This ends with what is perhaps the most famous telegram in the history of science: “monotremes oviparous, ovum meroblastic”. (The platypus lays eggs, and their development is more like reptiles than mammals.) However, it seems to me that much of the real intellectual action of the case was in the struggle to use different kinds of information about the platypus – including, but not limited to, its mode of reproduction – to see where it belongs in the overall scheme of biological classification. I would have loved to read more about that side of the story. But I guess it can’t be told unless we relax and make good use of our privileged present-day view of the case.

This is not to say that Moyal stays strictly in the past. In the final chapters, she reports on present-day findings about the platypus. These are among the most fascinating chapters. For instance, the platypus’s snout (famously “duck-like” in dead specimens, hence its scientific designation Ornithorhynchus anatinus, or “duck-like bird snout”) is in fact a unique organ for electrolocation. The platypus uses it to locate its prey as it dives with eyes and ears closed. In this respect the platypus is a highly specialized modern species rather than a relic of our evolutionary past. When I read about this, I thought it would have made for a great essay by Stephen Jay Gould. Of course, SJG was way ahead of me: you will find his highly enjoyable take on the story in Bully for Brontosaurus.

The diagram in the Origin of Species is not about common descent

It is a well known fact that Darwin’s On the Origin of Species contained only one figure: A rather arresting depiction of tree-like descent with modification. What is less well known is that Darwin does not introduce the figure in order to illustrate common descent. Since I’ve come across this misconception a number of times in the past days, I thought it was worth pointing this out.

Look at the figure carefully. Here it is (modified from the PDF of the first edition of The Origin of Species at


At first glance this certainly looks like a visual representation of common descent: The original species (A) diversifies into eight species, while (I) diversifies into six, with some side branches going extinct in both cases. However, the main message of the diagram is actually about something different.

The vertical axis of the diagram unsurprisingly represents time: There are 14 time steps between the original species (A) to (L) and their descendants a14 to z14. But the horizontal axis is also important. It is supposed to represent divergence between species. The idea is that among (A)’s descendants, the labeled descendants a1 and m1 differ the most from (A), while the intermediate offspring (not labeled) are more similar to (A). The vertical line above (A) designates offspring that are more or less identical to (A). Similarly, for example, the vertical line above (F) indicates that (F) does not change at all over time.

Now compare carefully the variations at each time step that survive for some time (perhaps even to the top of the diagram) to those that go extinct more or less quickly. You will find that it is for the most part the more extreme variations which survive, while the less extreme variations disappear.

What Darwin is trying to illustrate is his “principle of divergence”. This is an aspect of Darwin’s work that did not get accepted in modern evolutionary theory, and so it is always in danger of being in our blind spot when we read the historical sources.

For some time in the 1840s and 1850s, Darwin was worried that natural selection explained adaptation but not divergence. Why would there be many different species living today and not just a small number of highly adapted ones? What explains the abundant divergence of lineages in addition to their transformation toward better adapted forms?

Darwin’s answer was that there was an advantage to ecological differentiation:

We can clearly see this in the case of animals with simple habits. Take the case of a carnivorous quadruped, of which the number that can be supported in any country has long ago arrived at its full average. If its natural powers of increase be allowed to act, it can succeed in increasing (the country not undergoing any change in its conditions) only by its varying descendants seizing on places at present occupied by other animals: some of them, for instance, being enabled to feed on new kinds of prey, either dead or alive; some inhabiting new stations, climbing trees, frequenting waters, and some perhaps becoming less carnivorous. The more diversified in habits and structure the descendants of our carnivorous animal became, the more places they would be enabled to occupy. (p. 113)

Darwin next discusses a botanical example. He reports an experiment showing that if a plot of land is sown with one species of grass and another plot with several species, then the second plot will support a greater overall biological mass. In line with the quote above, he interprets this as showing that several divergent species can make better use of a plot of land than a single species can:

I cannot doubt that in the course of many thousands of generations, the most distinct varieties of any one species of grass would always have the best chance of succeeding and of increasing in numbers, and thus of supplanting the less distinct varieties; and varieties, when rendered very distinct from each other, take the rank of species. (p. 114, my emphasis)

Thus, the diagram is supposed to illustrate the origin of species by the principle of divergence:

Only those variations which are in some way profitable will be preserved or naturally selected. And here the importance of the principle of benefit being derived from divergence of character comes in; for this will generally lead to the most different or divergent variations (represented by the outer dotted lines) being preserved and accumulated by natural selection. (p. 117)

What Darwin is describing is a form of sympatric speciation, or of a species splitting into two species in the absence of geographical barriers. For much of the 20th century, the modern synthesis of evolution mainly recognized allopatric speciation, where a population is divided by a geographical barrier (such as a mountain, a river, and so on) into two populations, which then experience different selection pressures until they are sufficiently different to stop interbreeding and thus to count as different species. Sympatric speciation such as Darwin considered was thought not to occur in nature. In recent decades, however, evolutionists have started to take the possibility of sympatric speciation much more seriously again. Perhaps this will make it easier for the next generation of scholars to understand Darwin’s diagram in its intended context.

Mechanisms in 19th century evolutionary thought (or: How Darwin developed natural selection out of Lamarckian inheritance)

The episode of March 21 of the radio program In Our Time with Melvyn Bragg is on Alfred Russel Wallace, the co-discoverer of the principle of natural selection. It is on the whole very good. However, the episode may leave the listener with the wrong impression on one issue – and I think it is wrong in an interesting way.

It is claimed repeatedly in the episode that evolutionists other than Darwin and Wallace did not have a mechanism of evolution. This is true in the somewhat trivial sense that other evolutionists did not have the principle that Darwin and Wallace discovered, and that we still accept: natural selection. It is also true in the less trivial sense that other evolutionists did not have a mechanism that could explain adaptation without presupposing adaptation – that is, as the result of undirected processes. And it is certainly appropriate in a program for a general audience to draw a stark contrast between Darwin’s revolutionary mechanism and everything else.

However, it would be wrong to think that other evolutionists left the question of the mechanism of transformation entirely unanswered. Robert Chambers, the author of the influential The Vestiges of the Natural History of Creation of 1844, thought that God had created biological laws which predetermined the gradual unfolding of increasingly advanced forms of life (in parallel with the equally lawful unfolding of geological changes). We would today reject this sort of mechanism, and we would perhaps even deny that it is a mechanism because (as it turned out) it could not be reduced to more basic interactions. But it was nevertheless an attempt to explain biological structure and diversity by appeal to secondary causes. These secondary causes were in principle amenable to empirical investigation.

The same is true for the numerous evolutionists after Darwin and Wallace who accepted common descent but rejected natural selection as the mechanism of transformation. For instance, “Lamarckists” would have claimed that the main mechanism of transformation is the inheritance of acquired (adaptive) characters – that is, of the blacksmith’s son starting out with a particularly strong biceps. This was called Lamarckism after Jean-Baptiste, whose early theory of evolution included, among other things, a then-commonplace belief in the inheritance of acquired characters. Proponents of “orthogenesis” would have claimed that certain biological laws of development dictated the gradual changing of species (this is related to Chambers’ views). And “saltationists” would have argued that new biological forms come to be in variational leaps from earlier forms – caused by genetic laws yet to be determined.

Now, once we are aware of these alternative notions, some historical questions become much easier to approach and answer. My favorite example at the moment is the question of how Darwin came to formulate the principle of natural selection. Without the context of the alternative views, Darwin and Wallace both managed an almost unimaginable leap of the intellect. Placed within the context, however, we can discern a gradual development of correct ideas out of incorrect ones.

In its most abstract formulation, the principle of natural selection says that in a population with variation within the population, differential survival of some variants, and inheritance of variations, the better adapted forms will increase in frequency over the course of generations. Before Darwin’s notebooks of the years between 1836 and 1839 had been fully evaluated, authors such as Ernst Mayr largely had to speculate about Darwin’s path to the principle of natural selection. It is easy enough to find influences that may have prepared his mind for parts of the principle: For example, variation within populations and what Darwin called the “strong principle of inheritance” were well known to breeders, in whose work Darwin was deeply interested; and Robert Malthus’s Essay on the Principle of Population could have made Darwin aware of competition and differential survival within populations (Malthus famously argued that human populations grow exponentially while their means of subsistence only grow arithmetically). But these facts were widely available before Darwin, and so it remained somewhat mysterious how he (and, independently, Wallace) suddenly managed to put them all together in the principle of natural selection.

In the past decades, historical scholarship has clarified the question of Darwin’s path to natural selection considerably. In the following, I rely largely on Jonathan Hodge’s “The Notebook Programmes and Projects of Darwin’s London Years” in the Cambridge Companion to Darwin, although the original publications on these questions date back to the 1980s.

When Darwin was already assuming transformation and common descent, but before he discovered natural selection, he was apparently thinking about the process in terms of Lamarckism. So organisms acquired new, useful variations through the intensified use of certain organs, and these variations were then transmitted to their descendants (again: think of the blacksmith’s son). This was probably the best candidate for a mechanism of transformation before natural selection came along.

The crucial point is that the Lamarckian inheritance of acquired characters has surprisingly many similarities to natural selection! It is a process where variation within a population occurs, is adaptive, and is heritable. So it is not at all surprising that Darwin would have developed and pursued an interest in the nature of variation and inheritance while thinking about Lamarckism. Of the three main pillars of natural selection (variation, differential survival, and inheritance), two were important within the Lamarckian framework as well.

What seems to have happened when Darwin read Malthus in September of 1838 is that he began to think in earnest about the fate of advantageous (but use-acquired) variations within a population. He reasoned that the usefulness of certain (again: use-acquired) variations would be increased by the fact that there was competition for resources within the population. In essence, he came to regard population pressure as a reinforcement of the transformation of species by the inheritance of acquired characters.

This first step then allowed Darwin – several weeks later – to ask whether it mattered if useful variations came about in a directed (use-acquired) or an undirected (random) way. And the answer was, of course, no: even random variations could offer an advantage to an individual in a within-population struggle for existence.

And now Darwin was ready to formulate two versions of the process of transformation. In version one, variation came about in a directed way (through use and disuse), offered an advantage to the individual, was preserved in the struggle for existence, and was then inherited by the organism’s descendants. In version two, variation came about in an undirected, random way – and the rest was exactly the same, except that now the struggle for existence played a more crucial role in sorting out the favorable from the unfavorable variations.

Darwin later drew an analogy between natural selection and artificial selection by breeders. Artificial selection is “variation” + “selection by breeders” + “inheritance”. In natural selection,”selection by breeders” is replaced by “differential survival in the struggle for life”. For a long time we had to assume that this analogy played an important role in Darwin’s path to natural selection (just as it played an important part as a didactic tool in the first chapters of Darwin’s Origin of Species). This would have made a lot of sense! But as it turns out, the path actually led from the inheritance of acquired characters to natural selection – and Darwin only later saw the analogy between natural and artificial selection. This is a little ironic since Ernst Mayr, for example (in the paper linked above), saw Lamarckian inheritance purely as something that Darwin had to overcome in order to find natural selection. In truth, however, Lamarckian inheritance was not so much a hindrance on Darwin’s path to natural selection as it was a stepping stone.

Thus, Darwin’s correct mechanism grew out of his earlier belief in the incorrect mechanism of the inheritance of acquired characters, and so the discovery becomes somewhat less mysterious (although no less of an accomplishment). To see this, however, we have to be aware that evolutionists in the 19th century did have mechanisms other than natural selection. Without his earlier, false beliefs, Darwin might never have found natural selection at all. What I do not know (but will try to find out) is whether Wallace’s discovery followed a similar path.