Saturday, April 5, 2008

Black Swans

"Black Swans", as unlikely or unexpected economic events, are currently in the news. This usage was popularized by Nassim Nicholas Taleb. It was based on the old European belief that all swans were white, which was contradicted by the discovery of black swans in Australia. But as I discussed earlier genus and species are human-defined categories. There is no logical contradiction inherent in a black swan, and probabilities related to finding one are really probabilities of finding individuals (animal instances) fitting into ill-defined categories.

Note the first black swan was discovered in 1697, over 150 years before publication of Darwin's On the Origin of Species (1859) and over 250 years before Watson and Crick's A Structure for Deoxyribose Nucleic Acid (DNA) (1953). So seventeenth century notions of species would not include modern concepts of evolutionary descent or DNA similarity. Instead they were based on ideas of fixed categories inherited from Aristotle.

Progress in GPGPU Ray Tracing

I've been getting traffic and questions about my pages on Cell and CUDA ray tracing. Saarland University has been doing some interesting work on Cell and CUDA ray tracing including this paper: Realtime Ray Tracing on the GPU with BVH-based Packet Traversal.

Saturday, March 1, 2008

Funes el memorioso

AKA "Funes, His Memory", "Funes the Memorious", "Funes the Elephant-Memoried." Borges short story about a man who never forgets.

Funes, we must not forget, was virtually incapable of general, platonic ideas. Not only was it difficult for him to see that the generic symbol "dog" took in all the dissimilar individuals of all shapes and sizes, it irritated him that the "dog" of three-fourteen in the afternoon, seen in profile, should be indicated by the same noun as the dog of three-fifteen, seen frontally.
...
He had effortlessly learned English, French, Portuguese, Latin. I suspect, nevertheless, that he was not very good at thinking. To think is to ignore (or forget) differences, to generalize, to abstract. In the teeming world of Ireneo Funes there was nothing but particulars -- and they were virtually immediate particulars.


Collected Fictions, by Jorge Luis Borges, translated by Andrew Hurley, p. 136.

Saturday, February 2, 2008

Spiral Galaxy Generation in Ruby


The logarithmic spiral form often appears in nature. It is seen in nautilus shells, hurricanes, spiral galaxies, and plants. A simple Ruby program can be used to generate this pattern, and the results can be displayed with the GNU statistics package R. My Ruby code is available here.

Friday, January 25, 2008

Life is like JavaScript, not like Java

Today most object-oriented programming languages, such as Java, are based around the class concept. The class describes the properties shared by all instances (objects) of that class; and individual objects are created as instances of a particular class. Class-based object-oriented programming originated with Simula and Smalltalk. An alternative is prototype-based object-oriented programming. This is used in JavaScript, and originated with Self. In prototype-based object-oriented programming there are no classes, only instances. New instances are created by copying the properties of an existing instance (the prototype) and adding new properties.

The difference between class-based and prototype-based programming is a useful metaphor for understanding the complexities of the biological concept of Species. Life consists of instances copied from one another (like JavaScript). Species are a class hierarchy (like Java) we try to impose on the instances after the fact -- we forget species is a man-made construct. Nature just does whatever it does, and we try to simplify it by mapping to categories and rules. Certainly species is a useful concept for living in the world. You don't want to take a child to the zoo and say "see the animal instance?" "see the plant instance?" (or just "see the instance?" !). You want to say "see the giraffe?". However, the usefulness of species (or folk categories) does not mean they always obey our expectations.

The difference between class-based and prototype-based programming is also related to the philosophical Problem of Universals. Do classes exist in the real world, or only instances? The most famous theory of real-world classes is Plato's Theory of Forms. In Platonic Idealism pure archetypes for different objects (such as chairs, or giraffes), and ideas (such as justice, or triangles), actually exist in some other space or dimension our minds can contact. This theory was modified, but not completely rejected, by Aristotle's Theory of Universals. Aristotle thought universals were constructed from the common properties of the instances, rather than existing as pure Forms somewhere else. From these Greeks we inherited the idea of dividing the world up into invariant categories, and performing logical operations on them. That works to a point, and makes science possible. But the simplified model is not the real world -- "the map is not the territory".

The psychology of folk-biology, along with folk-psychology, folk-physics, etc. arose naturally through our evolutionary heritage and individual maturation and learning via interaction with the natural world. Even beliefs in the soul, etc. are understandable in this context. A great book on all this is Philosophy in the Flesh : The Embodied Mind and Its Challenge to Western Thought, by George Lakoff and Mark Johnson. Yes, it is a 624 page slog. In part II some of the examples can be skimmed. But if you make it through it will completely change your understanding of what metaphor is and how we think. You will realize that 99% of philosophy is out of date. That we often just trade one set of absolutes for another, without understanding the real biological reasons why we are wired to search for and believe in absolutes in the first place.

Sunday, January 20, 2008

Did the First Giraffe Have a Navel?

Intelligent Design is turning into a hot topic. Given all the efforts being made by IDers to get attention, it is surprisingly hard to find details on how their alternative to Evolution is supposed to work.

A common criticism among IDers is about the lack of fossils of "intermediate forms" between species that evolved from one another. The ID answer is that there was no intermediate form; instead the new species was created whole. An example of an allegedly missing intermediate form is a short-necked ancestor of the giraffe.

What I'm not finding any details about is exactly how, according to IDers, the first giraffe appeared. Did 2 adults (one male, one female) miraculously poof into existence a million years ago? Or was the first pair of baby giraffes born to and raised by deer? The first seems more likely if the intelligent designer was a deity, the second if it was space aliens[1].

Any links to explanations would be appreciated. Does anybody know if The Design of Life (3rd edition of the ID high school biology textbook Of Pandas and People) has an answer?

[1] "It could be space aliens," said William Dembski, a mathematician and philosopher at Baylor University in Texas and author of No Free Lunch [and later The Design of Life], a new book on intelligent design. "There are many possibilities." San Francisco Chronicle, Sunday, March 17, 2002

Sunday, December 2, 2007

OpenMP

Intel C++ supports OpenMP, a standardized API for shared-memory multiprocessing in C++. By adding a simple #pragma loops can be split up to automatically run in parallel on multiple cores. I added a simple change to the per-screen-line rendering loop of my generic ray tracer:

int screenX;
#ifdef USE_OMP
#pragma omp parallel for firstprivate(portPoint)
#endif
for (screenX = 0;
screenX < SCREEN_WIDTH;
screenX++) {

With this change each pixel is rendered by a separate thread, with a maximum of 4 (the number of cores) running simultaneously. This use of threads is an alternative to the explicit pthread threading tested previously, where a separate thread was used per line of the screen. In this case OpenMP is simpler than explicit threading, though it yields slightly lower performance.

GCC 4.2 also supports OpenMP, but its performance is much worse than Intel.