Jump to content

File:Swallowtail catastrophe animation.webm

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

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

Summary

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 = int(360 / num_frames)

stride = 5 width = 3

a = np.linspace(-width, width, 500) b = a x, y = np.meshgrid(a, b) z = np.clip(-y**4 - 0.1 * x**4 + (1 - 1 * x**2) * y**2 + 0.4 * x * y, -5, 5)

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 init():

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

def animate(i):

   ax.view_init(0, -90 + angle_per_frame * 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('basic_animation.webm', fps=video_fps, extra_args=['-vcodec', 'libx264'])

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.

Captions

Example swallowtail catastrophe, using $z = -y^4 - 0.1x^4 + (1-x^2)y^2 + 0.4xy$.

Items portrayed in this file

depicts

4 January 2023

File history

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

Date/TimeThumbnailDimensionsUserComment
current21:14, 4 January 202310 s, 1,000 × 1,000 (20.59 MB)Cosmia NebulaUploaded own work with UploadWizard
No pages on the English Wikipedia use this file (pages on other projects are not listed).

Metadata