Ising model autocorrelation function calculation

Click For Summary
The discussion focuses on calculating the autocorrelation functions for a 2D Ising model using a specified equation. The user describes their method for calculating the autocorrelation function (acf) of magnetization but notes that the results are unsatisfactory. There is confusion regarding the variable "act[]" mentioned in the code, which appears to be a typo, as it should be "acf[]". Participants suggest verifying the calculation with a smaller dataset before scaling up to ensure accuracy. Overall, the conversation emphasizes the importance of debugging and validating the code to achieve correct results.
yklee
Messages
1
Reaction score
0
Homework Statement
on going
Relevant Equations
$$c(t) = \langle A(t'+t) A(t) \rangle - \langle A \rangle^{2} = \frac{1}{t_{max}-t}\sum_{t'=0}^{t_{max}-t} A(t'+t)A(t) - \frac{1}{t_{max}-t}\sum_{t'=0}^{t_{max}-t}A(t'+t) \cdot \frac{1}{t_{max}-t} \sum_{t'=0}^{t_{max}-t}A(t)$$
Dear Mr. and Ms.,

I am trying to measure the autocorrelation functions of 2D ising model based on the equation given by
1659496169335.png

where A(t) denote a measure. I calculate a c(t) of magnetization. I calculated in this way

[CODE lang="python" title="acf"] data_path = f"../../trajectory/data.txt"
data = np.loadtxt(data_path)
Nsteps = len(data)
acf = np.zeros(Nsteps, float)
acf[0] = 1.000
for t in range(1,Nsteps):
value = np.mean(data[t:Nsteps]*data[:Nsteps-t]) - np.mean(data[t:Nsteps])*np.mean(data[:Nsteps-t])
act[t] = value[/CODE]

However, the results seems not good. Can you discuss the wrong part of my calculation?
 
Last edited:
Physics news on Phys.org
What is the act[] array? Everything else is acf. I am guessing this is a typo when you entered it here, as this should throw an error.

Other than that - a quick look at your code appears like it should replicate your formula.

Try running this on a small set of data, first - something that you could verify the result of. Then you can scale up to the full data.
 
Thread 'Why wasn’t gravity included in the potential energy for this problem?'
I’m looking at the attached vibration problem. The solution in the manual includes the spring potential energy but does NOT include the gravitational potential energy of the hanging mass. Can someone explain why gravitational potential energy is not included when deriving the equation of motion? I tried asking ChatGPT but kept going in circles and couldn't figure out. Thanks!

Similar threads

Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 41 ·
2
Replies
41
Views
5K