Recently, I have calculated the four-point correlation function \(\braket{C^\dagger_{\downarrow,i} C^\dagger_{\uparrow,i+1} C_{\downarrow,j+1} C_{\uparrow,j}}\) by using the expectation_value_term().

Code: Select all

```
def correlation(psi,a,b,c,d):
L = psi.L
f = np.zeros((L-1,L-1),dtype=complex)
for i in range(L-1):
for j in range(L-1):
f[i,j] = psi.expectation_value_term([(a,i),(b,i+1),
(c,j+1),(d,j)])
return f
```