<jupyter_start><jupyter_text>$$C_i(\tau)=\frac{1}{N_T-|\tau|} \sum_{t=\tau}^{N_T} (n_i(t)-P_i)(n_i(t-\tau)-P_i)$$for $\tau\in \lbrace 0,\dots N_T/2\rbrace$<jupyter_code>latexify.latexify(columns=2)
C_mean = np.mean(C,axis =0)
lag = np.arange(-np.floor(len(C_mean)/2),np.floor(len(C_mean)/2+0.5),dtype = int)
N_denominator = len(C_mean)-np.abs(lag) #number of terms in the sum
plt.plot(lag,np.abs(C_mean)/N_denominator/(C_mean[lag == 0]/N_denominator[lag ==0]),'-o')

plt.xlabel('lag,$\\tau$',fontsize = 12)
plt.ylabel('$C(\\tau)/C(0)$',fontsize = 12)
plt.xlim(0,20)
plt.semilogy()
#plt.tight_layout()
#plt.savefig('time_correlation.pdf')
plt.plot(lag,np.abs(C_mean)/N_denominator,'-o')
plt.xlim(0,20)
u = np.unique(np.abs(lag))
C_mean[u]-C_mean[-u]
sum(a[1:]*a[:-1]),np.correlate(a,a,'same')[lag ==1]<jupyter_output><empty_output><jupyter_text>Time correlation between states of direct neighbours<jupyter_code>G =nx.from_scipy_sparse_matrix(J,create_using=nx.DiGraph())
i,j = zip(*np.sort(G.edges(),axis = 1))
#spin = 2*trj-1
C2 = np.zeros((len(i),N_iterations))
for ind,(a,b) in enumerate(zip(trj[np.array(i)],trj[np.array(j)])):
    a = a-np.mean(a)
    b = b-np.mean(b)
    C2[ind]= np.correlate(a,b,'same')



len(np.mean(C2,axis = 1))
C2_mean = np.mean((C2.T/np.sqrt(C[np.array(i),lag ==0]*C[np.array(j),lag ==0])),axis =0)
lag = np.arange(-np.floor(len(C2)/2),np.floor(len(C2)/2+0.5),dtype = int)
N_denominator = len(C2)-np.abs(lag) #number of terms in the sum
plt.plot(lag,C2,'-o')
plt.xlabel('lag,$\\tau$')
plt.ylabel('$\\langle C_{ij}(\\tau)\\rangle/C(0)$')
#plt.xlim(-20,20)

x = np.arange(6)
y = np.arange(4,10)
print(np.correlate(x,y,'same'),np.correlate(x,y))
sum(x[1:]*y[:-1])
x[1:],x[:-1]
len(x)-np.abs(np.arange(-np.floor(len(x)/2),np.floor(len(x)/2+0.5),dtype = int))
np.abs(np.arange(-np.floor(len(x)/2),np.floor(len(x)/2+0.5),dtype = int))
np.correlate?<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2655099894847529, 'fraction_numerical': 0.03470031545741325, 'mean_word_length': 6.263358778625954, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '205942', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 974, 'n_tokens_neox': 938, 'n_words': 98, 'path': 'section_4/trajectory/trajectory.ipynb', 'repo_name': 'g-torr/uncovering-non-eq', 'size': '1902'}