Created
November 4, 2019 03:25
-
-
Save SeanChao/c7f16a69f6b0915bbe3829ee85253923 to your computer and use it in GitHub Desktop.
Iteration Funtion Plot
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
import matplotlib.pyplot as plt | |
import numpy as np | |
x = 0 | |
plotX = [] | |
plotY = [] | |
for k in np.arange(0, 2, 0.01): | |
for i in range(0, 600): | |
x = 1 - k * x ** 2 | |
if (i > 500): | |
plotX.append(k) | |
plotY.append(x) | |
# plt.scatter(k, x) | |
print('k =', k, 'x = ', x) | |
plt.xlabel('k') | |
plt.ylabel('x after 500 iterations') | |
plt.scatter(plotX, plotY, s=4, c='k') | |
plt.savefig('function.png', dpi=1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment