January 27, 2014

Color perception and antiferromagnetism


Here’s another thing about color chaos aka unitary vector field that makes it different from an Ising model: the energy function can be screwed up.

I’ve implemented the way of skewing it. Cell see its neighbors through light filter. In red area, it thinks its neighbors are slightly bluer than itself, whereas in reality they have the same color. In the similar fashion the blue cells are seen slightly greener, and green cells – slightly redder. This gives interesting psychedelic effects with variation of colors.


Interestingly, the rate at which colors changed depended on temperature – at high temperatures the changes were more rapid. That would be fun to explore in details how areas with different temperatures will interact with each other.

I could change color perception a little, but nothing stops me from making more radical change. For example, I could force cells see in inverted colors: cyan instead of red, magenta instead of green and yellow instead of blue. What I will get is model of antiferromagnetism.

Antiferromagnetic ordering
In antiferromagnets spins (little magnets) try not to be aligned with each other, but to have opposite orientations. Here is what YouTube made of a video of what I saw when I took a random pattern, then heat it and cool down again:



New rules give new structure. Here are snapshots:


To the right is the same frame with 2 times magnifications. There were stripped pattern in Ising model (which you can explore in my app), and here it appears again, only in color.

P.S. What did compression algorithm did to the picture?

Not so random colors

When I coded colorful chaos (field of unit vectors, I think, is proper name of what it is), I stumbled on a question how to generate random colors. With Ising model there’s the only way: I have to just flip between 0 and 1, black and white. With colors I could think of two ways: I can change color to any other random color on a wheel, or I could change color to nearby color.

In principle results should be the same: if new color is widely distributed, then cells update just won’t happen very often at low temperatures, and would happen much more frequently at high temperature. Even if new color is contained to vicinity of the old color of the cell, at high temperatures it won’t depend on its neighbors and would drift to randomness very soon.

I sought to check it, and implemented two schemes. In the first version, cell can change its color randomly to any other color. This is the video of annealing (starting from completely random pattern and high temperature and slowly lowering the temperature):


In the second way new color is normally distributed around old color and half-width of distribution 0.05 radians (2.8 degrees). This is very narrow distribution, and see what happened:


See how in the first video there is a violent mixing of colors at the beginning, and then it all pass through some critical point, and stabilize. In the second video I was unable to see any critical temperature. The system is cooled extremely smoothly.

I started experimenting with new way of generating colors, and found out that at high temperatures it behaves quite unexpectedly. The noise at high temperatures looked completely different. When I started from the field of red and raised temperature to high values, this is what I get:


Would I run the same simulation with the first way of generating colors, it would be complete mess almost instantly. But here – it preserved structure no matter how long I waited.

Colorful chaol

Soon after I made first version of Visual Chaos app, I started to think about something even more psychedelic than Ising model. What if instead of black and white there were colors? Say, each cell will have a color, and it likes to be surrounded by the cells of the same color.

The simplest way to do it that I thought of is to make use of color wheel:
If colors of two cells are near each other on the wheel, then their energy is minimal. If colors are opposite, energy is at its maximum.

Just as in regular Ising model, from time to time the cell will try to change its color. If cell is cool, it will change to minimize its energy, if cell is hot it may change even if energy goes up. Here is what I got. In the simulation the temperature first goes up, then down again to near zero.


If you see, at the last frame there are some interesting features – little color wheel, points where all colors meet each other, like on the color wheel. Little color wheels cannot be optimized out by lowering temperatures. If you think of it, it’s a deadlock configuration: take red cell, it has orange and magenta neighbors. If it moves to orange, magenta neighbor will object, if it moves to magenta, orange neighbor will be unhappy. The problem cannot be solved by small incremental steps; the only way to solve it is to heat it up, disrupt all colors, then cool down and see if it’s ok. I’ll call such points poles.

Another funny thing about poles is that they come into pairs. Here are few examples of annealing results:


There are poles that go from red to green to blue in clockwise direction, and there are poles that go in counter-clockwise direction. From time to time clockwise and counter-clockwise points collapse and annihilate, for example in this video:


I bet there are a some rules to be learned about how many poles can be formed, and how they evolve over time.