Jump to content

File:Animated construction of butterfly curve.gif

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

Animated_construction_of_butterfly_curve.gif (500 × 500 pixels, file size: 3.33 MB, MIME type: image/gif, looped, 202 frames)

Summary

Description
English: Animated construction of the mathematical function, butterfly curve

I made this with SAGE, an open-source math package, for entertainment, as an exercise. Permalink here; original source code (not this version) follows:

#*****************************************************************************
#       Copyright (C) 2008 Dean Moore
#
#
#  Distributed under the terms of the GNU General Public License (GPL)
#                  http://www.gnu.org/licenses/
#*****************************************************************************
# Animates the construction of the Butterfly Curve.
# Written by Dean Moore, March 30 -- April 01, 2008

def animate_curve((g,f), a, b, step, x_min, x_max, y_min, y_max, fig_size = 5):
    v = []
    def c(i):                                 # For output
       return ((i-a)/(b-a), 0, 1-(i-a)/(b-a)) # colors.

    for i in srange(a, b + step, step):
        if i >= b:
            curve_color=(0,0,1) # Final image is blue.
        else:
            curve_color = c(i)

        p = parametric_plot((g,f), 0, i, rgbcolor=curve_color, plot_points=50*(i-a+1)/step, thickness = 0.25)
        if i < b:
            p = p + points((g(i),f(i)),rgbcolor=(0,0,0), pointsize=10) # Terminal point on all but last image.
        v.append(p)
    a = animate(v, xmin=x_min, xmax = x_max, ymin = y_min, ymax = y_max, figsize=[fig_size,fig_size])
    return a

figure_size                            = 4
x_min = -4;x_max = 4;y_min = -2; y_max = 5
number_of_images_in_final_frozen_image = 12
delay_between_images                   = 0 

def g(x):
    return sin(x)*(e^(cos(x)) - 2*cos(4*x) - (sin(x/12))^5) # Parametric 
def f(x):                                                   # equations of the
    return cos(x)*(e^(cos(x)) - 2*cos(4*x) - (sin(x/12))^5) # Butterfly Curve. 

step = 0.5
b = animate_curve((g,f),0, 24*pi, step, x_min, x_max, y_min, y_max, figure_size)

d = animate([b[-1] for i in srange(0, number_of_images_in_final_frozen_image)], # Last image
             xmin=x_min, ymin=y_min,                                            # is "held" a
             xmax=x_max, ymax=y_max,                                            # time.
             figsize=[figure_size,figure_size])
(b*d).show(delay = delay_between_images)
Date
Source Own work (Original text: self-made)
Author dino (talk)

Licensing

Dino at English Wikipedia, the copyright holder of this work, hereby publishes it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
Attribution: Dino at English Wikipedia
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.
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
You may select the license of your choice.

Original upload log

The original description page was here. All following user names refer to en.wikipedia.
Date/Time Dimensions User Comment
2008-04-04 00:30 500×500× (3487267 bytes) Dino better version. Source code [https://www.sagenb.org/home/pub/1767/ here].
2008-04-02 02:10 400×400× (2216154 bytes) Dino

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

31 March 2008

image/gif

5d1fd6a3cd28956182a7826773645e21e0a08e7c

3,487,267 byte

500 pixel

500 pixel

File history

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

Date/TimeThumbnailDimensionsUserComment
current04:11, 8 August 2017Thumbnail for version as of 04:11, 8 August 2017500 × 500 (3.33 MB)BD2412Transferred from en.wikipedia

The following page uses this file:

Global file usage