File:Fold catastrophe animation.gif

From testwiki
Jump to navigation Jump to search
    Original file (480 × 480 pixels, file size: 15.43 MB, MIME type: image/gif, looped, 300 frames, 10 s)
    Note: Due to technical limitations, thumbnails of high resolution GIF images such as this one will not be animated.

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

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

    stride = 5 width = 3

    a = np.linspace(-width, width, 500) b = a x, y = np.meshgrid(a, b) z = -y**2- 0.1 * x**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 init():

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

    def animate(i):

       ax.view_init(angle_per_frame * i, -90)
       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('fold.mp4', 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:
    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.

    Captions

    Fold catastrophe, plotted with $z = -y^2- 0.1 x^4$

    Items portrayed in this file

    depicts

    4 January 2023

    16,174,792 byte

    480 pixel

    480 pixel

    image/gif

    65e3a4a06757881c4cc1e4d9d5543ef18e082c6f

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current23:15, 4 January 2023Thumbnail for version as of 23:15, 4 January 2023480 × 480 (15.43 MB)wikimediacommons>Cosmia NebulaUploaded own work with UploadWizard

    There are no pages that use this file.