File:Butterfly catastrophe animation.webm

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

Original file (WebM audio/video file, VP9, length 10 s, 1,000 × 1,000 pixels, 21.15 Mbps overall, file size: 25.21 MB)

Captions

Captions

Butterfly catastrophe, with surface $z=-20x^5 + 4x^3 - 2xy - 0.5 (x^4 + y^4)$

Summary

[edit]
Description
English: ```python

from mpl_toolkits import mplot3d import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation

video_length = 10 # in seconds video_fps = 30 num_frames = video_fps * video_length angle_per_frame = (360 / num_frames)

stride = 8 width = 1

a = np.linspace(-width, width, 600) b = a x, y = np.meshgrid(a, b) z = -20*x**5 + 4*x**3 - 2*y*x - 0.5 * (x**4 + y**4)

plt.tick_params(left = False) fig = plt.figure(figsize= (10,10)) ax = plt.axes(projection ='3d') frame = ax.plot_wireframe(x, y, z, color ='#4a5a90', rstride=stride, cstride=stride)

def scale(i):

   k = (i / num_frames * np.pi)
   return (1-np.cos(k))/2 * num_frames
  1. k = (i / num_frames - 0.5) * 10
  2. return (np.tanh(k)+1)/2 * num_frames

def init():

   ax.set_box_aspect((1,1,1))
   ax.view_init(0, 0)
   ax.axis('off')    
   ax.set_xlim(-0.2,0.2)
   ax.set_ylim(-0.2,0.2)
   ax.set_zlim(-0.1, 0.1)
   return frame,
  1. animation function. This is called sequentially

def animate(i):

   ax.view_init(0, 0 + angle_per_frame * scale(i))
   return frame,
  1. call the animator. blit=True means only re-draw the parts that have changed.

anim = animation.FuncAnimation(fig, animate, init_func=init,

                              frames=num_frames, blit=True)

anim.save('butterfly.mp4', fps=video_fps, extra_args=['-vcodec', 'libx264'])

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:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

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

Date/TimeThumbnailDimensionsUserComment
current00:15, 5 January 202310 s, 1,000 × 1,000 (25.21 MB)Cosmia Nebula (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Transcode status

Update transcode status
Format Bitrate Download Status Encode time
VP9 720P 3.31 Mbps Completed 00:16, 5 January 2023 58 s
VP9 480P 993 kbps Completed 09:37, 5 July 2024 29 s
VP9 360P 963 kbps Completed 00:15, 5 January 2023 33 s
VP9 240P 307 kbps Completed 09:36, 5 July 2024 15 s
WebM 360P 1.59 Mbps Completed 00:15, 5 January 2023 9.0 s
QuickTime 144p (MJPEG) 1.11 Mbps Completed 04:48, 18 October 2024 3.0 s

Metadata