File:Intermittency in logistic map, cobweb diagram.png

Summary

Description
English: ```python

import numpy as np import matplotlib.pyplot as plt

def logistic_map(x, r):

   return r * x * (1 - x)

def logistic_map_3(x, r):

   return logistic_map(logistic_map(logistic_map(x, r), r), r)

r = 3.8284 x_initial = 0.19 num_iterations = 75

  1. Generate x values for the cobweb plot

x_values = np.linspace(0, 1, 1000) y_values = logistic_map_3(x_values, r)

  1. Generate cobweb lines

x_cobweb = [x_initial] y_cobweb = [0]

for i in range(num_iterations):

   x_next = logistic_map_3(x_cobweb[-1], r)
   x_cobweb.append(x_cobweb[-1])
   y_cobweb.append(x_next)
   x_cobweb.append(x_next)
   y_cobweb.append(x_next)
  1. Plot the logistic map

plt.plot(x_values, y_values, label='Logistic map', color='blue') plt.plot(x_values, x_values, label='y = x', color='green')

  1. Plot the cobweb lines

plt.plot(x_cobweb, y_cobweb, color='red', alpha=0.5)

plt.xlabel('x') plt.ylabel('x_next') plt.legend() plt.title('Cobweb diagram for the logistic map with r = 3.8284')

plt.show()

```
Date
Source Own work
Author Cosmia Nebula

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-4.0#Intermittency%20in%20logistic%20map,%20cobweb%20diagram.pngCategory:Self-published work
Category:Cobweb plots Category:Logistic map Category:Dynamical systems Category:Created with Matplotlib
Category:CC-BY-SA-4.0 Category:Cobweb plots Category:Created with Matplotlib Category:Dynamical systems Category:Logistic map Category:Self-published work