Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- def logistic_map(r, x):
- return r * x * (1 - x)
- r = 3.5 # Задайте значение r здесь
- x = 0.5 # Задайте начальное значение x здесь
- # Создаем фигуру и оси
- fig, ax = plt.subplots(1, 1, figsize=(10, 10), dpi=80)
- # Строим линию y=x
- ax.plot([0, 1], [0, 1], 'k')
- # Строим логистическую функцию
- t = np.linspace(0, 1, 100)
- ax.plot(t, logistic_map(r, t), 'r')
- # Выполняем итерационный процесс и строим соответствующие линии
- for _ in range(100):
- y = logistic_map(r, x)
- ax.plot([x, x], [x, y], 'b', linewidth=1)
- ax.plot([x, y], [y, y], 'b', linewidth=1)
- x = y
- # Настраиваем график
- ax.set_xlim(0, 1)
- ax.set_ylim(0, 1)
- ax.set_title("Графический анализ логистического отображения")
- ax.set_xlabel("x")
- ax.set_ylabel("h(x)")
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement