## Study of phase transitions in elegans with simulated annealing

From Remotón.

I run 1000 parallel simulated annealings, temperature between 5 and 0.1, 200000 steps:

>> coste=simulaelegans_simulatedannealing_multiple_parallel(todas.A/29.3,todas.M/29.3+todas.S,todas.f,.5,.01,[.1 5],2*10^5,1000,’Prueba’);
>> [costemedio,varianza]=simulannealing2mediavarianza(‘Prueba’);
>> T=5:(.1-5)/(length(varianza)-1):.1;
>> plot(T,costemedio)

>> plot(T,varianza)

>> plot(T,varianza./T.^2)

Clearly, I need to go to lower temperatures. Maybe we also need to cool more slowly.

## Study of phase transitions

Working from Remoton.

I find the cost of 1.2*10^8 random configurations.

>> generacostes_rand(‘Costes_rand’,12,4)
>> [histog,bins]=costes_rand2histog(‘Costes_rand’,180:.5:260);
>> plot(bins,histog)

>> pos2coste(todas.A/29.3,todas.M/29.3+todas.S,todas.f,todas.pos_real,.5)
ans =
119.6195

Actual configuration has a cost much lower than those we get randomly. Therefore, this is not a valid scheme to see phase transitions in a range of temperatures similar to that of the real worm. Nevertheless, I will study the phase transitions with these data:

>> [costemedio,varianza]=costes_rand2mediavarianza(‘Costes_rand’,.1:.1:5,1);
>> T=.1:.1:5;
>> plot(T,costemedio)

>> plot(T,varianza)

There is this strange maximum. A possible explanation is that the effect of the exponential is to remove the peak of the cost distribution, producing something more uniform, which has larger variance. No me lo creo ni yo, pero bueno.

Specific heat:
>> plot(T,varianza./T.^2)

Uooooohhh!!!

I do not quite understand this. The cost histogram looks too boring to be hiding a phase transition. I run a control using normally distributed costs:

>> clear
>> costes=randn(1,10^7)*10;
>> save prueba1 costes
>> [costemedio,varianza]=costes_rand2mediavarianza(‘prueba’,.1:.1:5,1);
>> T=.1:.1:5;
>> plot(T,costemedio)

>> plot(T,varianza)

>> plot(T,varianza./T.^2)

Veeeery similar. So I do not think there is anything especial in the C. elegans cost.

Why is this apparent phase transition taking place? An older post showed that local minima were needed to get a phase transition. But anyway, the cost histogram for a single well is very different to the one we get here:

>> x=-1:.01:1;
coste=(abs(x)).^2;
>> hist(coste)

Indeed, the effect of a local minimum is to create a peak in the histogram of costs:

>> x=-1:.00001:1;
coste=(abs(x-.5)).^.5;
subplot(1,2,1)
plot(x,coste)
subplot(1,2,2)
hist(coste)

>> x=-1:.00001:1;
coste=(abs(x-.5)).^.5+.7*(abs(x+.6)).^.5;
subplot(1,2,1)
plot(x,coste)
subplot(1,2,2)
hist(coste)

## Second exploration of phase transitions: Transitions due to alternate optima

>> x=-1:.00001:1;
>> coste=(abs(x-.5)).^.5+.7*(abs(x+.6)).^.5;
>> plot(x,coste)

>> [calorespecifico,T,costemedio,varianza]=coste2calorespecifico(coste,[0 .5],1);

Apparently, no effect with just a change in the slope:

>> coste=(abs(x-.5)).^1+.7*(abs(x+.6)).^1;
>> plot(x,coste)

>> [calorespecifico,T,costemedio,varianza]=coste2calorespecifico(coste,[0 .5],1);

## First exploration of phase transitions: Fake transitions due to the binning.

I study the specific heat without doing the simulated annealing. I just assume one state per bin, and compute the probability as exp(-cost/temperature) for each state. Then the specific heat is the variance of the cost divided by the square of the temperature.

It seems that the binning may produce fake phase transitions near zero temperature, when the cost is narrow near the minimum:

Quadratic cost, and no fake phase transition despite the coarse binning:

>> x=-1:.01:1;
>> coste=(abs(x)).^2;
>> [calorespecifico,T,costemedio,varianza]=coste2calorespecifico(coste,[0 1],1);

Linear cost, and the fake phase transition appears:

>> coste=(abs(x)).^1;
>> [calorespecifico,T,costemedio,varianza]=coste2calorespecifico(coste,[0 .5],1);

Much more evident for sublinear cost:

>> coste=(abs(x)).^.5;
>> [calorespecifico,T,costemedio,varianza]=coste2calorespecifico(coste,[0 .5],1);

If I make a tighter binning, the maximum changes a lot (it even disappears if the binning is tight enough):

>> x=-1:.00001:1;
>> coste=(abs(x)).^.5;
>> [calorespecifico,T,costemedio,varianza]=coste2calorespecifico(coste,[0 .5],1);