# Homework Help: Numpy correlate, Monte Carlo

Tags:
1. Nov 6, 2017

### xperrylinn

I'm creating a Monte Carlo simulation of the 2D Ising Model for a graduate course in computational materials science. Part of the assignment is to calculate the uncertainty in the calculation of the average magnetization per spin. To do so, we are told to find the correlation time for our data set of average magnetization vs. number of spin flip attempts. We are instructed to do this by using built in methods provided by either Matlab, Mathematica, or in my case numpy since I'm coding in python to provide us with a correlation function which can be used in further steps to calculate the correlation time.

I've take a look at the numpy library and there is a feature called correlate. numpy.correlate that takes in two arrays, and calculates the cross correlation between the two data sets are returns a constant value. I don't see anything in the numpy library that returns a correlation function. Any suggestions on how to proceed? Thanks..

2. Nov 6, 2017

### donpacino

If you can't find one, why don't you write your own?! It is not that difficult.

If you really can't figure it out, why don't you try linear regression