File:Intermittency in logistic map, cobweb diagram.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Intermittency_in_logistic_map,_cobweb_diagram.png (567 × 455 pixels, file size: 42 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
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

[edit]
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.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current21:20, 18 April 2023Thumbnail for version as of 21:20, 18 April 2023567 × 455 (42 KB)Cosmia Nebula (talk | contribs)Uploaded while editing "Intermittency" on en.wikipedia.org

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata