File:Tautochrone curve.gif
来自Wikimedia Commons
跳转到导航
跳转到搜索
Tautochrone_curve.gif (300 × 200像素,文件大小:102 KB,MIME类型:image/gif、循环、80帧、3.2秒)
文件信息
结构化数据
说明
摘要
[编辑]描述Tautochrone 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. |
日期 | 2007年5月9日; new version 2009年8月 |
来源 | 自己的作品 |
作者 |
Claudio Rocchini |
GIF开发 InfoField | 本GIF 位图使用Matplotlib创作。 |
源代码 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)
|
许可协议
[编辑]我,本作品著作权人,特此采用以下许可协议发表本作品:
已授权您依据自由软件基金会发行的无固定段落及封面封底文字(Invariant Sections, Front-Cover Texts, and Back-Cover Texts)的GNU自由文件许可协议1.2版或任意后续版本的条款,复制、传播和/或修改本文件。该协议的副本请见“GNU Free Documentation License”。http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
本文件采用知识共享署名-相同方式共享 3.0 未本地化版本许可协议授权。 | ||
| ||
本许可协议标签作为GFDL许可协议更新的组成部分被添加至本文件。http://creativecommons.org/licenses/by-sa/3.0/CC BY-SA 3.0Creative Commons Attribution-Share Alike 3.0truetrue |
您可以选择您需要的许可协议。
文件历史
点击某个日期/时间查看对应时刻的文件。
日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
---|---|---|---|---|---|
当前 | 2009年8月1日 (六) 13:15 | 300 × 200(102 KB) | Geek3(留言 | 贡献) | new physically correct version | |
2007年5月9日 (三) 06:56 | 300 × 200(602 KB) | Rocchini(留言 | 贡献) | {{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 }} |
您不可以覆盖此文件。
文件用途
以下5个页面使用本文件:
全域文件用途
以下其他wiki使用此文件:
- ar.wikipedia.org上的用途
- bn.wikipedia.org上的用途
- ca.wikipedia.org上的用途
- da.wikipedia.org上的用途
- de.wikipedia.org上的用途
- de.wikiversity.org上的用途
- en.wikipedia.org上的用途
- es.wikipedia.org上的用途
- fa.wikipedia.org上的用途
- fr.wikipedia.org上的用途
- fr.wikibooks.org上的用途
- fr.wiktionary.org上的用途
- he.wikipedia.org上的用途
- hr.wikipedia.org上的用途
- hu.wikipedia.org上的用途
- id.wikipedia.org上的用途
- it.wikipedia.org上的用途
- ja.wikipedia.org上的用途
- kk.wikipedia.org上的用途
- ko.wikipedia.org上的用途
- lt.wikipedia.org上的用途
- lv.wikipedia.org上的用途
- nl.wikipedia.org上的用途
- nn.wikipedia.org上的用途
- no.wikipedia.org上的用途
- pl.wikipedia.org上的用途
- pt.wikipedia.org上的用途
- ro.wikipedia.org上的用途
- ru.wikipedia.org上的用途
- sl.wikipedia.org上的用途
- tr.wikipedia.org上的用途
- www.wikidata.org上的用途
- zh.wikipedia.org上的用途