Advertisement
vatman

Untitled

Dec 19th, 2023
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. def logistic_map(r, x):
  5. return r * x * (1 - x)
  6.  
  7. logistic_map_vec = np.vectorize(logistic_map)
  8.  
  9. r_values = np.linspace(2, 4, 1000)
  10. iterations = 1000
  11. last = 100
  12.  
  13. x = 1e-5 * np.ones(len(r_values))
  14.  
  15. fig, ax = plt.subplots(figsize=(10, 7))
  16. for i in range(iterations):
  17. x = logistic_map_vec(r_values, x)
  18. if i >= (iterations - last):
  19. ax.plot(r_values, x, ',k', alpha=.25)
  20. ax.set_xlim(2, 4)
  21. ax.set_title("Бифуркационная диаграмма для логистической карты")
  22. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement