File:Folded towel map attractor, animated.gif

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file(2,000 × 2,000 pixels, file size: 71.77 MB, MIME type: image/gif, 120 frames, 9.6 s)

Note: Due to technical limitations, thumbnails of high resolution GIF images such as this one will not be animated.

Summary

Description
English: ```python

import numpy as np

def dynamical_system(x, y, z, a, b, n_iter):

   x_values = np.empty(n_iter)
   y_values = np.empty(n_iter)
   z_values = np.empty(n_iter)
   x_values[0] = x
   y_values[0] = y
   z_values[0] = z
   for i in range(1, n_iter):
       x, y, z = x_values[i], y_values[i], z_values[i] = a * x * (1 - x) - 0.05 * (y + 0.35) * (1 - 2 * z), 0.1 * ((y + 0.35) * (1 + 2 * z) - 1) * (1 - 1.9 * x), 3.78 * z * (1 - z) + b * y
   return x_values, y_values, z_values
  1. Parameters

a = 3.8 b = 0.2 x_init = 0.085 y_init = -0.121 z_init = 0.075 n_iter = 800000

x, y, z = dynamical_system(x_init, y_init, z_init, a, b, n_iter)

init_time = 1000

def normalize(x):

   a, b = np.quantile(x, 0.999), np.quantile(x, 0.001)
   return 2 * (x - (a+b)/2) / (a - b)

x = normalize(x)[init_time:] y = normalize(y)[init_time:] z = normalize(z)[init_time:] print(min(x), max(x), min(y), max(y), min(z), max(z))

%%capture import matplotlib.pyplot as plt import numpy as np import os

for i, theta in enumerate( np.linspace(0, 2*np.pi, 120)):

   fig, ax = plt.subplots(figsize=(20, 20))
   init_time = 1000
   ax.scatter(y*np.cos(theta) + z*np.sin(theta), x, color='k', s=0.005)
   ax.axis("off")
   ax.set_xlim(-1.06, 1.06)
   ax.set_ylim(-1.03, 1.03)
   dir_path = f"./towel"
   if not os.path.exists(dir_path):
       os.makedirs(dir_path)
   fig.savefig(f"{dir_path}/{i}.png")
   plt.close()

import imageio.v3 as iio import os from natsort import natsorted import moviepy.editor as mp

for dir_path in ["./towel"]:

   file_names = natsorted((fn for fn in os.listdir(dir_path) if fn.endswith('.png')))
   # Create a list of image files and set the frame rate
   images = []
   fps = 12
   # Iterate over the file names and append the images to the list
   for file_name in file_names:
       file_path = os.path.join(dir_path, file_name)
       images.append(iio.imread(file_path))
   filename = dir_path[2:]
   iio.imwrite(f"{filename}.gif", images, duration=1000/fps, rewind=True)
   clip = mp.ImageSequenceClip(images, fps=fps)
   clip.write_videofile(f"{filename}.mp4")
```
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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

24 April 2023

image/gif

File history

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

Date/TimeThumbnailDimensionsUserComment
current06:45, 25 April 2023Thumbnail for version as of 06:45, 25 April 20232,000 × 2,000 (71.77 MB)Cosmia NebulaUploaded while editing "Hyperchaos" on en.wikipedia.org
The following pages on the English Wikipedia use this file (pages on other projects are not listed):