Skip to content

Instantly share code, notes, and snippets.

@SeanChao
Created November 4, 2019 03:25
Show Gist options
  • Save SeanChao/c7f16a69f6b0915bbe3829ee85253923 to your computer and use it in GitHub Desktop.
Save SeanChao/c7f16a69f6b0915bbe3829ee85253923 to your computer and use it in GitHub Desktop.
Iteration Funtion Plot
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