!========================================================
! "Solutions" for D=2 Monte Carlo Ising Model study --- !
! at least, the way I did things.                       !
!========================================================




=========================================================
! Start with data away from critical point:  JJ < JJ_c, or T > T_c.  
! 100,000 sweeps, unless otherwise specified.
!
=========================================================
! First try
! JJ = 0.42
! CPU time used is: 257.5 sec.
!
! spin-spin correlation function along a row
   1.0000000000000000
   0.6245600000000000
   0.4609600000000000
   0.3716400000000000
   0.3255400000000001
   0.2906800000000000
   0.2639400000000000
   0.2424400000000000
   0.2222000000000000
   0.2125200000000000
   0.1947400000000000
   0.1794400000000000
   0.1651400000000000
   0.1496200000000000
   0.1347600000000000
   0.1288400000000000
   0.1306600000000000
   0.1364400000000000
   0.1463000000000000
   0.1590200000000000
   0.1710000000000000
   0.1860400000000000
   0.2000400000000000
   0.2206800000000000
   0.2473200000000001
   0.2749200000000001
   0.3234000000000001
   0.3749600000000000
   0.4623000000000002
   0.6210400000000000

For T > T_c, average spin should be zero, and we should extract the
same "mass" from the exponential fall-off of either the above
raw spin-spin correlation function or the connected spin-spin
correlation function below.

For the raw function,
from an average of the logs of ratios of consecutive j's of 
<s_{1,1} s_{1,j} > for j from 5 to 13 we get a mass in lattice units
of

raw_avg_mass_5_13 := .08637628841

We used j from 5 to 13 because the ratios were pretty stable there.
At shorter times there is interference from excited states,
while for j > 13 there is interference from the "mirror source"
due to the periodic boundary conditions.

This is not really the best way to extract the mass, because it
doesn't take into account that the statistical precision on the 
short-time points is better than the long-time points ...


 connected spin-spin correlation function along the row
   0.9999510000000000
   0.6244594800000000
   0.4608858000000000
   0.3715980000000000
   0.3255138200000001
   0.2906853200000000
   0.2639684200000000
   0.2424341200000000
   0.2221938400000000
   0.2125410000000000
   0.1947429400000000
   0.1794332800000000
   0.1651174600000000
   0.1495904600000000
   0.1346897200000000
   0.1287940800000000
   0.1306399800000000
   0.1363543200000000
   0.1461800200000000
   0.1588297400000000
   0.1707373600000000
   0.1858056400000000
   0.1998882400000000
   0.2205881600000000
   0.2472480400000001
   0.2749032000000001
   0.3233706000000001
   0.3749530000000000
   0.4622741000000000
   0.6210083600000000

For the connected function,
from an average of the logs of ratios of consecutive j's of 
<s_{1,1} s_{1,j} > for j from 5 to 13, 
we get a mass in lattice units of

conn_avg_mass_5_13 := .08638929158

This is very consistent with the "raw" mass.

==============================================================

! I repeated this job, with a new random number seed:
! CPU time used is: 257.3 sec.
!
! JJ = 0.42
!
! spin-spin correlation function along a row
   1.0000000000000000
   0.6267600000000000
   0.4696200000000000
   0.3745800000000000
   0.3204000000000000
   0.2740800000000000
   0.2421800000000000
   0.2269800000000000
   0.2122600000000000
   0.1975000000000000
   0.1841200000000000
   0.1703000000000000
   0.1603800000000000
   0.1569000000000000
   0.1452600000000000
   0.1430200000000000
   0.1515400000000000
   0.1504200000000000
   0.1598600000000000
   0.1654600000000000
   0.1816400000000000
   0.1921200000000000
   0.2060800000000000
   0.2184400000000000
   0.2391000000000000
   0.2675400000000000
   0.3167400000000000
   0.3753799999999999
   0.4660400000000000
   0.6259000000000002

The same procedure leads to a mass of
 new_raw_avg_mass_5_13 := .07932906171  

 connected spin-spin correlation function along the row
ss_conn[1] :=      0.9999190000000004 :
ss_conn[2] :=      0.6267207599999999 :
ss_conn[3] :=      0.4696738200000000 :
ss_conn[4] :=      0.3746341800000002 :
ss_conn[5] :=      0.3205044000000000 :
ss_conn[6] :=      0.2741919600000000 :
ss_conn[7] :=      0.2423630600000000 :
ss_conn[8] :=      0.2271270600000000 :
ss_conn[9] :=      0.2123401000000000 :
ss_conn[10] :=      0.1975361800000000 :
ss_conn[11] :=      0.1840926400000000 :
ss_conn[12] :=      0.1702530200000000 :
ss_conn[13] :=      0.1603096200000000 :
ss_conn[14] :=      0.1567788600000000 :
ss_conn[15] :=      0.1450704600000000 :
ss_conn[16] :=      0.1427667399999999 :
ss_conn[17] :=      0.1511780200000000 :
ss_conn[18] :=      0.1499194200000000 :
ss_conn[19] :=      0.1592237000000000 :
ss_conn[20] :=      0.1648132600000000 :
ss_conn[21] :=      0.1810215200000000 :
ss_conn[22] :=      0.1915098000000000 :
ss_conn[23] :=      0.2055418000000001 :
ss_conn[24] :=      0.2179561600000000 :
ss_conn[25] :=      0.2386073400000001 :
ss_conn[26] :=      0.2671283399999999 :
ss_conn[27] :=      0.3163992600000001 :
ss_conn[28] :=      0.3749960600000000 :
ss_conn[29] :=      0.4657592000000003 :
ss_conn[30] :=      0.6257176600000003 :

The same procedure leads to a mass of
new_conn_avg_mass_5_13 := .07945108078

Averaging the two runs, where the error assignment is somewhat
arbitrary, gives a mass in lattice units of 
0.083 +- 0.004 at JJ = 0.42.

Doing a least-squares fit (from 5 to 27) to 
C * ( exp(-(j-1)*mass) + exp(-(31-j)*mass) )
gives more like 
mass = 0.12.

=====================================================================

! Repeat at JJ = 0.43.
! 100,000 sweeps  
! CPU time used is: 261.8 sec.
!
! spin-spin correlation function along a row
   1.0000000000000000
   0.6585200000000000
   0.5271200000000000
   0.4561400000000000
   0.4071000000000000
   0.3682800000000001
   0.3391600000000000
   0.3177400000000001
   0.3063800000000000
   0.2913000000000000
   0.2815000000000000
   0.2690600000000000
   0.2660200000000000
   0.2643600000000000
   0.2618800000000000
   0.2636599999999999
   0.2583000000000000
   0.2631600000000002
   0.2621400000000000
   0.2743800000000000
   0.2922400000000000
   0.3022400000000000
   0.3099800000000000
   0.3288400000000001
   0.3447200000000001
   0.3661600000000000
   0.4064600000000000
   0.4572400000000000
   0.5272800000000000
   0.6629800000000000

This time our "average mass" is

raw_avg_mass_5_13 := .04797189396

But because the ratios don't look very stable over the whole range,
(at short-times this is because the first excited state now lives longer), 
we also try averaging over a narrower range, 7 to 11:

raw_avg_mass_7_11 := .04630751402


 connected spin-spin correlation function along the row
ss_conn[1] :=   0.9981441136000004 :
ss_conn[2] :=   0.6562712240000000 :
ss_conn[3] :=   0.5248384832000001 :
ss_conn[4] :=   0.4536956408000000 :
ss_conn[5] :=   0.4049623704000000 :
ss_conn[6] :=   0.3657537888000000 :
ss_conn[7] :=   0.3366734224000001 :
ss_conn[8] :=   0.3153059800000001 :
ss_conn[9] :=   0.3044301991999999 :
ss_conn[10] :=   0.2895449208000000 :
ss_conn[11] :=   0.2798207416000001 :
ss_conn[12] :=   0.2674824104000000 :
ss_conn[13] :=   0.2645854360000001 :
ss_conn[14] :=   0.2629090656000000 :
ss_conn[15] :=   0.2607133936000000 :
ss_conn[16] :=   0.2620169288000000 :
ss_conn[17] :=   0.2563243512000001 :
ss_conn[18] :=   0.2609560272000000 :
ss_conn[19] :=   0.2598524520000002 :
ss_conn[20] :=   0.2720597111999999 :
ss_conn[21] :=   0.2903169088000001 :
ss_conn[22] :=   0.3005374783999999 :
ss_conn[23] :=   0.3082507688000000 :
ss_conn[24] :=   0.3271512639999999 :
ss_conn[25] :=   0.3429881840000000 :
ss_conn[26] :=   0.3643334079999999 :
ss_conn[27] :=   0.4048893031999999 :
ss_conn[28] :=   0.4556391472000000 :
ss_conn[29] :=   0.5255860944000001 :
ss_conn[30] :=   0.6610974039999999 :

Using the connected data doesn't change the masses appreciably. 

But doing a least-squares fit (from 5 to 27) to 
C * ( exp(-(j-1)*mass) + exp(-(31-j)*mass) )
gives more like 
mass = 0.09  (with pretty large errors).

=====================================================================

! Repeat at JJ = 0.435.
! 100,000 sweeps  
! CPU time used is: 262.6 sec.
!
! spin-spin correlation function along a row
   1.0000000000000000
   0.6890000000000001
   0.5714399999999999
   0.5081400000000001
   0.4686400000000000
   0.4416800000000001
   0.4184200000000002
   0.4008000000000000
   0.3887400000000000
   0.3866599999999999
   0.3919800000000000
   0.3832199999999999
   0.3846599999999999
   0.3845200000000000
   0.3852400000000000
   0.3899800000000000
   0.3913800000000002
   0.3882800000000001
   0.3875800000000000
   0.3881400000000000
   0.3972200000000000
   0.4060600000000000
   0.4132800000000000
   0.4313600000000000
   0.4361600000000000
   0.4565200000000000
   0.4822800000000000
   0.5145400000000002
   0.5719800000000000
   0.6866800000000001
 connected spin-spin correlation function along the row
   0.9870267900000002
   0.6757989900000000
   0.5577423860000001
   0.4940938520000001
   0.4554617700000000
   0.4284425420000001
   0.4063283760000000
   0.3892801539999999
   0.3770174120000000
   0.3751788800000000
   0.3804259840000001
   0.3716842080000001
   0.3723223520000000
   0.3722939740000000
   0.3727725059999999
   0.3775238960000001
   0.3779625799999999
   0.3752976780000002
   0.3749507680000000
   0.3752237400000000
   0.3851739360000001
   0.3941369480000000
   0.4011040899999999
   0.4191932020000000
   0.4236970620000000
   0.4437882580000000
   0.4693614620000000
   0.5011726960000003
   0.5580523080000004
   0.6735837780000000

This data really has too slow of a fall-off to be able to
extract a meaningful mass, on this small a lattice.
The ratios never really plateau.

So we should back off to a somewhat smaller value of JJ

=========================================================
!
! JJ = 0.40
!
! CPU time used is: 261.9 sec.
!
! spin-spin correlation function along a row 
! (ignore this, in favor of connected data below)
   1.0000000000000000
   0.5534000000000000
   0.3649600000000000
   0.2542800000000001
   0.1844800000000000
   0.1424600000000000
   0.1125000000000000
   8.6120000000000002E-02
   7.0360000000000006E-02
   5.9740000000000001E-02
   5.0979999999999998E-02
   3.8339999999999999E-02
   2.9960000000000001E-02
   2.8160000000000001E-02
   2.0959999999999999E-02
   1.9879999999999998E-02
   1.7999999999999999E-02
   2.6419999999999999E-02
   3.9059999999999997E-02
   4.0860000000000000E-02
   4.5760000000000002E-02
   5.1659999999999998E-02
   6.9040000000000004E-02
   8.9959999999999998E-02
   0.1185600000000000
   0.1579000000000000
   0.1981200000000000
   0.2613000000000000
   0.3621400000000001
   0.5537400000000000

 connected spin-spin correlation function along the row
ss_conn[1] :=   0.9990377596000005 :
ss_conn[2] :=   0.5527802204000000 :
ss_conn[3] :=   0.3643079596000002 :
ss_conn[4] :=   0.2535187692000000 :
ss_conn[5] :=   0.1836728596000000 :
ss_conn[6] :=   0.1417018712000000 :
ss_conn[7] :=   0.1118485800000000 :
ss_conn[8] :=   8.5773196400000001E-02 :
ss_conn[9] :=   7.0318433200000002E-02 :
ss_conn[10] :=   5.9646940000000002E-02 :
ss_conn[11] :=   5.0930367999999997E-02 :
ss_conn[12] :=   3.8383427999999997E-02 :
ss_conn[13] :=   2.9858874800000001E-02 :
ss_conn[14] :=   2.8134563600000002E-02 :
ss_conn[15] :=   2.0898580399999998E-02 :
ss_conn[16] :=   1.9473637999999998E-02 :
ss_conn[17] :=   1.7458390799999998E-02 :
ss_conn[18] :=   2.5845509600000000E-02 :
ss_conn[19] :=   3.8643091200000000E-02 :
ss_conn[20] :=   4.0350031199999997E-02 :
ss_conn[21] :=   4.5205982800000002E-02 :
ss_conn[22] :=   5.0834867999999998E-02 :
ss_conn[23] :=   6.8113742800000002E-02 :
ss_conn[24] :=   8.8940682800000004E-02 :
ss_conn[25] :=   0.1175518500000000 :
ss_conn[26] :=   0.1567683904000000 :
ss_conn[27] :=   0.1970026596000000 :
ss_conn[28] :=   0.2601125544000001 :
ss_conn[29] :=   0.3609376648000001 :
ss_conn[30] :=   0.5526381696000000 :


We find for the average mass, from 5 to 13:
conn_avg_mass_5_13 := .2084619329

Doing a least-squares fit (from 5 to 27) to 
C * ( exp(-(j-1)*mass) + exp(-(31-j)*mass) )
gives more like 
mass = 0.25.

============================================================

Now try to fit:
m = 0.208    at    J_c-J = 0.0407
m = 0.083    at    J_c-J = 0.0207
m = 0.047    at    J_c-J = 0.0107 

Looks roughly linear ....

Using least-squares fit, 
m = 0.25    at    J_c-J = 0.0407
m = 0.12    at    J_c-J = 0.0207
m = 0.09    at    J_c-J = 0.0107 

Also looks roughly linear, except for the last, not-too-well-determined 
point.

Linear is the right answer:  At the critical point, the theory
is the theory of a massless free fermion,

L = i \psi \del-slash \psi i \psi-bar \del-slash \psi-bar 
    + m \psi-bar \psi,

where m vanishes at the critical point.  But \psi-bar \psi is
also the "energy" operator; i.e., the local Hamiltonian becomes
 H \propto s_a s_b \propto \psi-bar \psi
in the continuum limit, so m must be proportional to the temperature.

But I won't claim that we made a very good determination of eta (nu)
here!

The least squares fit mass extraction gives an exponent anywhere
in the range 0.4 - 1.1.
 
The first mass extraction gives an exponent anywhere
in the range 0.8 - 1.4. 



=========================================================
=  Data right at critical point, JJ = JJ_c =  .4406867935
=========================================================
!
200          ! Number of initialization sweeps N_init
100000       ! Number of measurement sweeps N_sweep
! CPU time used is: 256.8 sec.
!
! JJ = JJ_c
!
! spin-spin correlation function along a row 
! (ignore below in favor of connected data)
   1.0000000000000000
   0.7173600000000000
   0.6109000000000002
   0.5554600000000001
   0.5278799999999999
   0.5135000000000000
   0.4967400000000001
   0.4867800000000001
   0.4869199999999999
   0.4842000000000001
   0.4776999999999999
   0.4742600000000000
   0.4754400000000000
   0.4734200000000002
   0.4722600000000001
   0.4720200000000000
   0.4691600000000000
   0.4744000000000000
   0.4818000000000000
   0.4827800000000001
   0.4828200000000001
   0.4922400000000000
   0.4929000000000002
   0.5025400000000000
   0.5108400000000000
   0.5253600000000000
   0.5468600000000002
   0.5755400000000002
   0.6248200000000003
   0.7198200000000000

 connected spin-spin correlation function along the row
ss_conn[1] :=   0.9926965884000001:
ss_conn[2] :=   0.7095916860000000:
ss_conn[3] :=   0.6035709504000001:
ss_conn[4] :=   0.5492487672000000:
ss_conn[5] :=   0.5220533372000000:
ss_conn[6] :=   0.5077365776000000:
ss_conn[7] :=   0.4907543816000001:
ss_conn[8] :=   0.4807567791999999:
ss_conn[9] :=   0.4813052779999999:
ss_conn[10] :=   0.4791903348000000:
ss_conn[11] :=   0.4721997944000002:
ss_conn[12] :=   0.4684350464000001:
ss_conn[13] :=   0.4697569100000000:
ss_conn[14] :=   0.4673044823999999:
ss_conn[15] :=   0.4660145831999999:
ss_conn[16] :=   0.4658805536000001:
ss_conn[17] :=   0.4632547140000000:
ss_conn[18] :=   0.4678144524000000:
ss_conn[19] :=   0.4747495500000000:
ss_conn[20] :=   0.4751330392000000:
ss_conn[21] :=   0.4747867600000001:
ss_conn[22] :=   0.4841811220000001:
ss_conn[23] :=   0.4846343088000000:
ss_conn[24] :=   0.4941649200000001:
ss_conn[25] :=   0.5024085163999999:
ss_conn[26] :=   0.5174412764000001:
ss_conn[27] :=   0.5392335496000000:
ss_conn[28] :=   0.5684502384000001:
ss_conn[29] :=   0.6179490160000001:
ss_conn[30] :=   0.7124772768000005:

I did a least-squares fit of this distribution to 
C * f(j,beta) =  C * ( (j-1)^(-beta) + (31-j)^(-beta) ) ; 
i.e. I minimized 
SSQ = \sum_{j=2}^{30} (ss_conn[j] - C * f(j,beta))^2,

I first minimized SSQ with respect to C analytically:
The value of C at the minimum is
C = \sum_{j=2}^{30} ss_conn[j] * f(j,beta) / \sum_{j=2}^{30} f(j,beta)^2

I then plugged this into SSQ, and minimized numerically with respect to
beta, obtaining  beta = 0.295.

The true value, I happen to know, is beta = 0.250.

Is my value wrong because of statistical errors?
I don't think so, because if I determine C using the known value of
beta, I get C = .4653125351 from my data.
If I use this C, and minimize SSQ with respect to beta, I get
beta = 0.252.

From a 2-dimensional contour plot of SSQ, I see that there is a 
strong correlation between C and beta.  Probably there is 
a better way to decouple the uninteresting normalization (C) 
from the interesting critical exponent, beta.

But at least we know the data is legitimate! 

For the isotropy check, I computed the ratio (which ideally
should be 1):

rr[j] = ss[j]*(j-1)^(1/4) / (ssd[j]*(sqrt(2)*(j-1))^(1/4)) :

rr[2] := 1.008404177
rr[3] := .9930224058
rr[4] := .9852662416
rr[5] := .9821439923
rr[6] := .9756678586
rr[7] := .9523889682
rr[8] := .9563413755
rr[9] := .9576186983
rr[10] := .9509625821
rr[11] := .9550615230
rr[12] := .9680105726

So, it's within 5%...






