Last active
April 12, 2018 23:11
-
-
Save randompast/0691612db51a51cc65fbf9fc597b6fee to your computer and use it in GitHub Desktop.
This generates a series of images that I turned into a logistic map. (link to gif in comment)
This file contains hidden or 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
import sys | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def f(a, x): | |
return a*x*(1 - x) | |
n = 1000 | |
imgs = 50 | |
for k in np.arange(imgs): | |
for j in np.arange(n+1): | |
a = j / 250.0 | |
x = np.arange(n)/(1.0*n) | |
for i in range(k): | |
x = f(a, x) | |
sys.stdout.write("Progress: %d%% - %d%% \r" % (100.0*j/n, 100.0*(k)/imgs)) | |
sys.stdout.flush() | |
plt.plot(np.ones(len(x))*a, x, "b,") | |
plt.savefig(("%03d" % (k,))+"_out.png") | |
plt.clf() | |
# https://twitter.com/randompast/status/984569577697882112 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment