File:Tautochrone curve.gif
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Tautochrone_curve.gif (300 × 200 pixels, file size: 102 KB, MIME type: image/gif, looped, 80 frames, 3.2 s)
File information
Structured data
Captions
Summary
[edit]DescriptionTautochrone curve.gif |
A tautochrone curve is the curve for which the time taken by an object sliding without friction in uniform gravity to its lowest point is independent of its starting point. Here, four points at different positions reach the bottom at the same time. In the graphic, s represents arc length, t represents time, and the blue arrows represent acceleration along the trajectory. As the points reach the horizontal, the velocity becomes constant, the arc length being linear to time. |
Date | 9 May 2007; new version August 2009 |
Source | Own work |
Author |
Claudio Rocchini |
GIF development InfoField | This plot was created with Matplotlib. |
Source code InfoField | Python code#!/usr/bin/python
# -*- coding: utf8 -*-
'''
animation of balls on a tautochrone curve
'''
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib import animation
from math import *
# settings
fname = 'Tautochrone curve'
width, height = 300, 200
nframes = 80
fps=25
balls = [
{'a':1.0, 'color':'#0000c0'},
{'a':0.8, 'color':'#c00000'},
{'a':0.6, 'color':'#00c000'},
{'a':0.4, 'color':'#c0c000'}]
def curve(phi):
x = phi + sin(phi)
y = 1.0 - cos(phi)
return np.array([x, y])
def animate(nframe, empty=False):
t = nframe / float(nframes - 1.)
# prepare a clean and image-filling canvas for each frame
fig = plt.gcf()
fig.clf()
ax_canvas = plt.gca()
ax_canvas.set_position((0, 0, 1, 1))
ax_canvas.set_xlim(0, width)
ax_canvas.set_ylim(0, height)
ax_canvas.axis('off')
# draw the ramp
x0, y0 = 293, 8
h = 182
npoints = 200
points = []
for i in range(npoints):
phi = i / (npoints - 1.0) * pi - pi
x, y = h/2. * curve(phi) + np.array([x0, y0])
points.append([x, y])
rampline = patches.Polygon(points, closed=False, facecolor='none',
edgecolor='black', linewidth=1.5, capstyle='butt')
points += [[x0-h*pi/2, y0], [x0-h*pi/2, y0+h]]
ramp = patches.Polygon(points, closed=True, facecolor='#c0c0c0', edgecolor='none')
# plot axes
plotw = 0.5
ax_plot = fig.add_axes((0.47, 0.46, plotw, plotw*2/pi*width/height))
ax_plot.set_xlim(0, 1)
ax_plot.set_ylim(0, 1)
for b in balls:
time_array = np.linspace(0, 1, 201)
phi_pendulum_array = (1 - b['a'] * np.cos(time_array*pi/2))
ax_plot.plot(time_array, phi_pendulum_array, '-', color=b['color'], lw=.8)
ax_plot.set_xticks([])
ax_plot.set_yticks([])
ax_plot.set_xlabel('t')
ax_plot.set_ylabel('s')
ax_canvas.add_patch(ramp)
ax_canvas.add_patch(rampline)
for b in balls:
# draw the balls
phi_pendulum = b['a'] * -cos(t * pi/2)
phi_wheel = 2 * asin(phi_pendulum)
phi_wheel = -abs(phi_wheel)
x, y = h/2. * curve(phi_wheel) + np.array([x0, y0])
ax_canvas.add_patch(patches.Circle((x, y), radius=6., zorder=3,
facecolor=b['color'], edgecolor='black'))
ax_plot.plot([t], [1 + phi_pendulum], '.', ms=6., mec='none', mfc='black')
v = h/2. * np.array([1 + cos(phi_wheel), sin(phi_wheel)])
vnorm = v / hypot(v[0], v[1])
# in the harmonic motion, acceleration is proportional to -position
acc_along_line = 38. * -phi_pendulum * vnorm
ax_canvas.arrow(x, y, acc_along_line[0], acc_along_line[1],
head_width=6, head_length=6, fc='#1b00ff', ec='#1b00ff')
fig = plt.figure(figsize=(width/100., height/100.))
print 'saving', fname + '.gif'
#anim = animation.FuncAnimation(fig, animate, frames=nframes)
#anim.save(fname + '.gif', writer='imagemagick', fps=fps)
frames = []
for nframe in range(nframes):
frame = fname + '_{:02}.png'.format(nframe)
animation.FuncAnimation(fig, lambda n: animate(nframe), frames=1).save(
frame, writer='imagemagick')
frames.append(frame)
# assemble animation using imagemagick, this avoids dithering and huge filesize
os.system('convert -delay {} +dither +remap -layers Optimize {} "{}"'.format(
100//fps, ' '.join(['"' + f + '"' for f in frames]), fname + '.gif'))
for frame in frames:
if os.path.exists(frame):
os.remove(frame)
|
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following licenses:
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.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license. | ||
| ||
This licensing tag was added to this file as part of the GFDL licensing update.http://creativecommons.org/licenses/by-sa/3.0/CC BY-SA 3.0Creative Commons Attribution-Share Alike 3.0truetrue |
This file is licensed under the Creative Commons Attribution 2.5 Generic 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.
You may select the license of your choice.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 13:15, 1 August 2009 | 300 × 200 (102 KB) | Geek3 (talk | contribs) | new physically correct version | |
06:56, 9 May 2007 | 300 × 200 (602 KB) | Rocchini (talk | contribs) | {{Information |Description=Tautochrone curve animation (4 points runs over a cycloid) |Source=Own work |Date=2007-05-09 |Author=Claudio Rocchini |Permission=CC-BY 2.5 }} |
You cannot overwrite this file.
File usage on Commons
The following 5 pages use this file:
File usage on other wikis
The following other wikis use this file:
- Usage on ar.wikipedia.org
- Usage on bn.wikipedia.org
- Usage on ca.wikipedia.org
- Usage on da.wikipedia.org
- Usage on de.wikipedia.org
- Usage on de.wikiversity.org
- Usage on en.wikipedia.org
- Usage on es.wikipedia.org
- Usage on fa.wikipedia.org
- Usage on fr.wikipedia.org
- Usage on fr.wikibooks.org
- Usage on fr.wiktionary.org
- Usage on he.wikipedia.org
- Usage on hr.wikipedia.org
- Usage on hu.wikipedia.org
- Usage on id.wikipedia.org
- Usage on it.wikipedia.org
- Usage on ja.wikipedia.org
- Usage on kk.wikipedia.org
- Usage on ko.wikipedia.org
- Usage on lt.wikipedia.org
- Usage on lv.wikipedia.org
- Usage on nl.wikipedia.org
- Usage on nn.wikipedia.org
- Usage on no.wikipedia.org
- Usage on pl.wikipedia.org
- Usage on pt.wikipedia.org
- Usage on ro.wikipedia.org
- Usage on ru.wikipedia.org
- Usage on sl.wikipedia.org
- Usage on tr.wikipedia.org
- Usage on www.wikidata.org
- Usage on zh.wikipedia.org