Computing mean square displacement using python and FFT
问题 Given a 2 dimensional array, where each row represents the position vector of a particle, how do I compute the mean square displacement efficiently (using FFT)? The mean square displacement is defined as where r(m) is the position vector of row m, and N is the number of rows. 回答1: The following straight forward method for the msd works, but it is O(N**2) (I adapted the code from this stackoverflow answer by user morningsun) def msd_straight_forward(r): shifts = np.arange(len(r)) msds = np