Created
September 11, 2016 16:12
-
-
Save bmtgoncalves/3fcce41b89191d4da408def5bde36d9b to your computer and use it in GitHub Desktop.
Bak_Sneppen model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bak_sneppen(data, steps=10): | |
N = len(data) | |
for i in range(steps*N): | |
pos = np.argmin(data) # Find the position of the minimum value | |
# Replace the minimum valuea and both it's neighbours | |
data[(pos-1) % N] = np.random.random() | |
data[pos] = np.random.random() | |
data[(pos+1) % N] = np.random.random() | |
return data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment