Archive for computers

A Simple Problem in Statistical Physics

Posted in Cute Problems with tags , , , , on July 11, 2011 by telescoper

In physics we often have to resort to computer simulations in which continuously varying quantities are modelled on a discrete lattice. We also have recourse from time to time to model physical properties of a system as random quantities with some associated probability distribution. The following problem came up in a conversation recently, and I think it’s rather cute so thought I’d post it here.

Consider a regular three-dimensional Cartesian grid, at each vertex of which is defined a continuous variable x which varies from site to site with the same probability distribution function F(x) at each location. The value of x at any vertex can be assumed to be statistically independent of the others.

Now define a local maximum of the fluctuating field defined on the lattice to be a point at which the value of x is higher than the value at all surrounding points, defined so that in D dimensions there are 3^{D}-1 neighbours.

What is the probability that an arbitrarily-chosen point is a local maximum?

Solution

Well, the most popular answer is in fact the correct one but I’m quite surprised that a majority got it wrong! Like many probability-based questions there are quick ways of solving this, but I’m going to give the laborious way because I think it’s quite instructive (and because I’m a bit slow).

Pick a point arbitrarily. The probability that the associated value lies between x and x+dx is f(x)dx, where f(x)=dF(x)/dx is the probability density function. According to the question there are 3^3-1=26 neighbours of this point. The probability that all of these are less than x isF(x)\times F(x)\times \ldots F(x) 26 times, i.e. [F(x)]^{26}  becauses they are independent. Note that this is a continuous variable so the probability of any two values being equal is zero. The probability of the chosen point being a local maximum with a given value of x is therefore f(x)dx\times [F(x)]^{26}. The probability of it being a local maximum with any value of x is obtained by integrating this expression over all allowed values of x, i.e. \int f(x) dx [F(x)]^{26} . But the integrand can be re-written

\int f(x) dx [F(x)]^{26} = \int dF \times F^{26} = \frac{1}{27} \int d\left(F^{27}\right) = \frac{1}{27},

because  F=1 at the upper limit of integration and F=0  at the bottom.

So you don’t need to know the form of F(x) – but the calculation does rely on it being a continuous distribution.

This long-winded method demonstrates the applicability of the product rule and the process of marginalising over variables, but the answer should tell you a much quicker way of getting there.  The central point and the 26 neighbours constitute a set of 27 points. The probability that any particular one is the largest of the set is just 1/27, as each is equally likely to be the largest. This goes for the central value too, hence the answer.

 

Feynman on Computers

Posted in The Universe and Stuff with tags , on July 8, 2011 by telescoper

This is a special one for all those people who prefer fiddling about with computers to actually doing science with them!

Well, Mr. Frankel, who started this program, began to suffer from the computer disease that anybody who works with computers now knows about. It’s a very serious disease and it interferes completely with the work. The trouble with computers is you *play* with them. They are so wonderful. You have these switches – if it’s an even number you do this, if it’s an odd number you do that – and pretty soon you can do more and more elaborate things if you are clever enough, on one machine.

After a while the whole system broke down. Frankel wasn’t paying any attention; he wasn’t supervising anybody. The system was going very, very slowly – while he was sitting in a room figuring out how to make one tabulator automatically print arc-tangent X, and then it would start and it would print columns and then bitsi, bitsi, bitsi, and calculate the arc-tangent automatically by integrating as it went along and make a whole table in one operation.

Absolutely useless. We *had* tables of arc-tangents. But if you’ve ever worked with computers, you understand the disease – the *delight* in being able to see how much you can do. But he got the disease for the first time, the poor fellow who invented the thing.

Richard Feynman (1918-1988)