Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Numpy correlate, Monte Carlo

  1. Nov 6, 2017 #1
    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. jcsd
  3. Nov 6, 2017 #2


    User Avatar
    Gold Member

    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
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted