## Thursday, November 29, 2018

### Thermodynamics

log(Temperature) =

Energy =

This little project is based on Dan Schroeder's Ising Model animation.

The way this kind of simulation works is that cells in the array are considered one by one. At a particular cell, alternative configurations are examined and one configuration is selected to be newly assigned to the cell. Each possible configuration, or value of the order parameter, will have an energy which is determined by the configurations of the neighboring cells. The new configuration is picked at random, with a bias toward lower energy configurations. The lower the temperature, the stronger the bias.

One of the tricky parts about this kind of simulation: when the order parameter is continuous, it's hard to come up with a good set of alternative values. The full set of alternatives is huge, practically infinite. Some small sample needs to be used. The small sample needs to include some configurations whose energy is at least not too much worse than the existing configuration, or the simulation won't have a good alternative to assign to the cell. At high temperatures, suitable alternatives can be substantially worse. At low temperatures, the alternatives can only be slightly worse. Thus, the temperature determines what makes a good set of alternatives. Trying to figure out that relationship ahead of time is too complicated, so an adaptive approach is suitable.

What I do in this simulation is to consider alternatives one by one. The first alternative is chosen at random at random from the full set. Each next alternative is chosen from those that are within some range of the currently assigned configuration. As each configuration is chosen, a decision is made whether to assign that to the cell in place of the current configuration. As soon as a new configuration is assigned, the simulation moves on to look at other cells. When an alternative is not assigned, another alternative is chosen from a narrower range. The range from which alternatives are picked gets narrower and narrower with each iteration. Eventually the alternatives are so close to the current assignment that the odds of being assigned become 50/50. This narrowing range iteration provides an adaptive approach to picking a set of alternative configurations.

## Wednesday, November 28, 2018

### Interaction

Left Side Offset:

Left Side Direction:

Right Side Offset:

Right Side Direction:

Interaction Energy =

The foundation for the dynamics of a system is the way the components interact. The "wrinkles" system that I am exploring is a two dimensional array of cells. Each cell interacts with its four neighbors. The state of each cell is given by a direction and an offset. These change over time. In the thermodynamic simulation that I am building, a cell will tend to change so its direction and offset are similar to those of its neighbors.

Handling the offset gets tricky. The idea is that the dark and light strips should line up on the boundary between neighboring cells. If the cells have the same direction, the offsets should simply match. But when the cells have different directions, it gets messy!

What I'm doing to manage this is to look solely at the midpoint of the edge that forms the boundary between two neighboring cells. The offsets are close if the stripes fit together at that midpoint.

There is some topological strangeness here. The light and dark stripes have a symmetry: if you turn them upside-down, the result is the same pattern as where you started. But at the two extremes of cell direction, increasing offset will move the stripes in the opposite direction. Changing the direction rotates the stripes: every 180 degree brings the stripes back to where they were. Similarly, changing the offset enough will move the stripes back to where they started. So the topology of these two parameters together forms a kind of torus. But because the direction of offset is reversed after a 180 degree change of direction, the topology is actually that of a Klein bottle. This topology is what allows an array such as:

## Monday, November 26, 2018

### Order Parameter

My plan is currently to develop an animation for the "wrinkles" simulation I built a while back. Mostly it's a matter of translating C# into javascript. But I'll develop it in stages, from the ground up. That'll give me an opportunity to explain the bits and pieces which will also work as a kind of unit test.

Offset:

Direction:

Quite a blast, huh?! I am using Dan Schroeder's tutorial to figure this stuff out!

In case anybody else wants to play like this in blogger... I am not entirely sure, but it seems like variables are shared across scripts, across posts. The code I put in one post interacts with the code I put in other posts. So far I am managing this by making lots of new variable names. Maybe there is a better way, but I don't really plan to take this little project very far anyway!

## Sunday, November 25, 2018

### Animation

Maybe the time has finally come to learn javascript! Take a look at Dan Schroeder's Ising Model!

Just too much fun! Step 1: just get javascript to work here!