Pages

Wednesday, November 7, 2012

Nuclide Chart

One sunday morning in October, I woke up early to go to the Hopper exhibition in the Grand Palais, Paris with a friend. I wanted to see his paintings, some of them famous, even to those who do not know who he is. I like the contrast between the reassuring gentleness of the overview, and the crudeness (sometimes cruelty) of the details.

 


But the waiting time in the line was several hours, even though we arrived at the first hour ! So instead, we ended up in the Palais de La Découverte, next door. There it was blissfully empty, at this hour. This place is welcoming and designed for children, I think, even though many adults would learn a thing or two, or more, strolling along the corridors and reading the description panels, and watching the funny experiments on display. The good old planetarium is also very nice... But there is something peculiar about the atmosphere, something difficult to describe, an impression I rarely get..  It felt that I had traveled back in time. The inside of the Museum could have been exactly the same at any point in time from 40 years back to yesterday. I felt in a time warp !

Admittedly that is rather a good sign for a Museum, but I suspect I tend to identify sciences and technology, quite naturally in my view. In the latter field however, every concept, every item carries a very clear time stamp. In the Palais de La Découverte, on the contrary, it is late 19th - early 20th century science all over the place. This period in history is arguably one of most fertile in terms of scientific progress. It was breakthrough after breakthrough, in many disciplines. The human mind was furiously mapping Nature. And science was held in very high esteem, an unequivocal source of good. As the 20th century painfully rolled out, opinions gradually changed..

So I could not help thinking that the Museum would benefit from an upgrade and a strengthening of the connection between fundamental sciences and its applications. I would also use the vast real estate more efficiently, cram more presentations/experiments, systematically put the material on line too, and direct the visitor to related web sites, display the text in several languages (at the very least English), maybe even sublet a part of the Museum to technological/scientific companies/student bodies, if only to introduce some uncontrolled element in the place.

Now, I must be unfair to some of sections of the Museum. Surely they have some exhibitions in tune with the current zeitgeist  For example, there must be a section about climate change, a relatively new concern. There are some touch screens, but very few. Alternatively, one could defend the position that this dated atmosphere is completely intended, and must be carefully maintained. One could also point out that my suggestions are utopian, and that the Museum does very well with the budget. I would still think there is room for improvement.



In spite of all the remarks above, I enjoyed it very much. Especially the 'Atomic section'. I came across an enlightening short movie introducing the Nuclide Chart, the Valley of Stability, and basic radioactivity concepts, in no more than 5mn, and it was astonishingly clear !


Tuesday, October 16, 2012

Convolve n Square Pulses to Gaussian

The other day, I was perusing Wikipedia, and stumbled upon the convolution page.
Intrigued by the convolution of 2 square pulses, which is a triangular function, I set about convolving a square pulse with itself several times and soon empirically observed that it seems to converge to a Gaussian shape, and fast.

The graph below shows the result of such convolutions for n from 0 (initial square pulse) to 9.


After only 3 convolutions the resulting function is visually indistinguishable from a Gaussian shape.



Sunday, September 30, 2012

Snake Cube


Last December, a young cousin of mine got a snake cube for Christmas. He showed it to me. Even though I have never seen that thing, I took a low pitched voice, hinted with a lot of self confidence that it was very easy to do/undo it. In the manipulation, I unfolded it and... was completely unable to fold it again into its original cube shape. I was a little bit ridiculous  and later decided that at least there is a good way to turn this domestic defeat into a learning experience: I should solve this snake cube.. No ! All snake cubes !! Forever !!!  

Nothing difficult, of course, but the problem still requires to be approached in an organized fashion.

Introduction


A snake cube puzzle is a string of 27 cubes connected by an elastic that goes through each cube. The elastic goes either straight through the cube, from one face to the opposite, or turns inside the cube and goes from one face to an adjacent. The aim of the game is to fold it into a 3x3x3 cube, if possible. It is usually quite difficult to do it the first time, when a snake does not have many solutions.





Our objective here is to find all possible solution snake cubes (ignoring rotations and reflections), and sort them to try and make sense of how this population is distributed. To be more specific, any 2 snakes that are identical after a series of rotations and/or reflections are considered one solution.

A solution snake cube is an undirected Hamiltonian path in the 3x3x3 grid graph.

In order to explore the possibilities in an orderly and economical way, we first describe a method to travel inside the grid graph, starting from specific first few vertices all the way to Hamiltonian path. We try to avoid doing redundant searches. Indeed the cube has many symmetric axes, and many symmetric starting points. There are many possibilities to explore so this concern for optimisation is no luxury.

Once the search is complete, we sort the solution snake cube (the "paths") by letter sequence. A letter sequence is a string of 27 letters that define a snake cube puzzle.
  • E for and end cube.
  • S for a 'straight' cube; the elastic goes from one face to the opposite face.
  • C for a 'corner' cube; the elastic goes from one face to an adjacent face.

Within all the paths for one sequence, we determine the "base" paths, ie those which cannot be deducted one from the other by a combination of rotations and/or reflections ("transformations"). This step requires a lot of calculations so all transformation are computed beforehand. 

Finally we get all the base paths and can examine the results.


Monday, September 24, 2012

Poker 4: Monte Carlo Analysis

Why using Monte Carlo to compute poker probabilities ?
Because in a number of cases, the number of possibilities is way to large to be explored.

For example, computing the equity of on player's PreFlop hand that has NbOpp opponents sitting around the table requires to go through N different game configurations:
\[\left(
\begin{array}{c}
 52-2(\text{NbOpp}+1) \\
 5 \\
\end{array}
\right)\prod _{i=1}^{\text{NbOpp}} \left(
\begin{array}{c}
 52-2i \\
 2 \\
\end{array}
\right)\]
Even a very fast hand evaluator on a modern machine does not parse much more than 300 millions hands per second, which leaves the exact computation of a PreFlop hand equity for 4 or more players completely out of reach.

As cheesy as it may be, the table below helps visualizing the kind of numbers at play.



Naturally the numbers are meaningless past the 1 or 2 opponents case.
So computing the equity of PreFlop hand in the general case is practically impossible.
Let us turn to Monte Carlo simulations to at least approach these values.

Saturday, September 22, 2012

Poker 3: Exhaustive Analysis

There are 169 different possible PreFlop hands:
  • C(13,2) = 78 suited hands
  • C(13,2) = 78 offsuited hands, excluding pairs
  • 13 pairs

For a given such Pre Flop hand, let us generate all possible 5 table cards. There are C(50,5) = 2,118,760 different tables. Assuming each set of table cards is equally likely, i.e. neglecting the other players hole cards, we can compute the distribution of hand ranks associated to a PreFlop hand.