File:Inclinedthrow2.gif
From Wikipedia, the free encyclopedia
Inclinedthrow2.gif (400 × 288 piksèl, gwosè fichye a : 378 kio, tip MIME li ye : image/gif, en boucle, 102 trames, 10 s)
Fichye sa a sòti nan Wikimedia Commons e ka sèvi nan lòt pwojè. Desktripsyon ki sou paj li file description page ekri anba a.
Rezime
DeskripsyonInclinedthrow2.gif |
English: Animations of an inclined throw with no drag (black), Stokes drag (blue) and Newton drag (green). Launch angle: 70°, g=1, v0=1.25, terminal velocity for both drag types: vmax=0.65. |
Dat | |
Sous | Travay pèsonèl |
Kreyatè | Geek3 |
Autres versions | Inclinedthrow.gif |
GIF information InfoField | ![]() Cette représentation graphique a été créée avec Matplotlib |
Code source InfoField | Python code#!/usr/bin/python3
# -*- coding: utf8 -*-
import os
import inspect
from math import *
import numpy as np
from scipy.integrate import odeint
from scipy.optimize import newton
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import animation
# settings
mpl.rcParams['path.snap'] = False
fname = 'inclinedthrow2'
size = 400, 288
l, w, b, h = 22.5/size[0], 1-23/size[0], 22.5/size[1], 1-23/size[1]
nframes = 102
delay = 8
lw = 1.
ms = 6
c1, c2, c3 = "#000000", "#0000ff", "#007100"
def projectile_motion(g, mu, pot, xy0, vxy0, tt):
# use a four-dimensional vector function vec = [x, y, vx, vy]
def dif(vec, t):
# time derivative of the whole vector vec
v = hypot(vec[2], vec[3])
vxrel, vyrel = vec[2] / v, vec[3] / v
return [vec[2], vec[3], -mu * v**pot * vxrel, -g - mu * v**pot * vyrel]
# solve the differential equation numerically
vec = odeint(dif, [xy0[0], xy0[1], vxy0[0], vxy0[1]], tt)
return vec[:, 0], vec[:, 1], vec[:, 2], vec[:, 3] # return x, y, vx, vy
g = 1.
theta = radians(70)
v0 = sqrt(g/sin(2*theta))
vinf = 0.65
# use identical terminal velocity vinf for both types of friction
mu_stokes = g / vinf**1
mu_newton = g / vinf**2
x0, y0 = 0.0, 0.0
vx0, vy0 = v0 * cos(theta), v0 * sin(theta)
T = newton(lambda t: projectile_motion(g, 0, 0, (x0, y0), (vx0, vy0), [0, t])[1][1], 2*vy0/g)
nsub = 10
tt = np.linspace(0, T * nframes / (nframes - 1), (nframes - 1) * nsub + 1)
traj_free = projectile_motion(g, 0, 0, (x0, y0), (vx0, vy0), tt)
traj_stokes = projectile_motion(g, mu_stokes, 1, (x0, y0), (vx0, vy0), tt)
traj_newton = projectile_motion(g, mu_newton, 2, (x0, y0), (vx0, vy0), tt)
def animate(nframe, saveframes=False):
print(nframe, '/', nframes)
t = T * float(nframe) / nframes
plt.clf()
fig.gca().set_position((l, b, w, h))
fig.gca().set_aspect("equal")
plt.xlim(0, 1)
plt.ylim(0, (h*size[1]) / (w*size[0]))
plt.xticks([]), plt.yticks([])
plt.xlabel('Distance', size=12)
plt.ylabel('Height', size=12)
plt.plot(traj_free[0][:nframe*nsub+1], traj_free[1][:nframe*nsub+1],
'-', lw=lw, color=c1)
plt.plot(traj_free[0][nframe*nsub], traj_free[1][nframe*nsub],
'o', color=c1, markersize=ms, markeredgewidth=0)
plt.plot(traj_stokes[0][:nframe*nsub+1], traj_stokes[1][:nframe*nsub+1],
'-', lw=lw, color=c2)
plt.plot(traj_stokes[0][nframe*nsub], traj_stokes[1][nframe*nsub],
'o', color=c2, markersize=ms, markeredgewidth=0)
plt.plot(traj_newton[0][:nframe*nsub+1], traj_newton[1][:nframe*nsub+1],
'-', lw=lw, color=c3)
plt.plot(traj_newton[0][nframe*nsub], traj_newton[1][nframe*nsub],
'o', color=c3, markersize=ms, markeredgewidth=0)
if saveframes:
# export frame
dig = int(ceil(log10(nframes)))
fsavename = ('frame{:0' + str(dig) + '}.svg').format(nframe)
fig.savefig(fsavename)
with open(fsavename) as f: content = f.read()
content = content.replace('pt"', 'px"').replace('pt"', 'px"')
with open(fsavename, 'w') as f: f.write(content)
fig = plt.figure(figsize=(size[0]/72., size[1]/72.))
os.chdir(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))
for i in range(nframes):
animate(i, True)
os.system('convert -loop 0 -delay ' + str(delay) + ' frame*.svg +dither ' + fname + '.gif')
# keep last frame for two seconds
os.system('gifsicle -k32 --color-method blend-diversity -b ' + fname + '.gif -d' + str(delay) + ' "#0-' + str(nframes-2) + '" -d200 "#' + str(nframes-1) + '"')
for i in os.listdir('.'):
if i.startswith('frame') and i.endswith('.svg'):
os.remove(i)
|
Kondisyon itlizasyon
Moi, en tant que détenteur des droits d’auteur sur cette œuvre, je la publie sous la licence suivante :
![w:fr:Creative Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/CC_some_rights_reserved.svg/90px-CC_some_rights_reserved.svg.png)
![Rekonèt avèk non otè](https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Cc-by_new_white.svg/24px-Cc-by_new_white.svg.png)
![Enfòmasyon sa yo ka pataje](https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Cc-sa_white.svg/24px-Cc-sa_white.svg.png)
Ce fichier est sous la licence Creative Commons Attribution – Partage dans les Mêmes Conditions 4.0 International.
- Ou gen dwa:
- pou pataje – pou kopye, distribiye epi difize ouvraj la
- pou remiks – pou adapte ouvraj la
- Selon kondisyon sa a yo:
- Rekonèt avèk non otè – Ou dwe bay enfòmasyon apwopriye sou otè a, bay yon lyen pou lisans lan, epi endike si te gen chanjman ki fèt. Ou ka fè sa nan nenpòt fason rezonab, men okenn fason ki sijere ke otè a soutni oswa apwouve itilizasyon ou an.
- Enfòmasyon sa yo ka pataje – Si ou fè rekopye, transfòme, oswa baze sou materyèl sa, ou dwe distribye kontribisyon ou anba menm oswa yon lisans konpatib avèk orijinal la.
Légendes
Ajoutez en une ligne la description de ce que représente ce fichier
Éléments décrits dans ce fichier
dépeint français
trajectoire d'un projectile français
créé par français
Valeur sans élément de Wikidata
statut des droits d'auteur français
sous droit d'auteur français
date de fondation ou de création français
21 oktòb 2020
source du fichier français
Istorik fichye a
Klike sou yon dat/yon lè pou wè fichye a jan li te ye nan moman sa a.
Dat ak lè | Minyati | Grandè yo | Itilizatè | Komantè | |
---|---|---|---|---|---|
Kounye a | 21 oktòb 2020 à 16:28 | ![]() | 400 × 288 (378 kio) | Geek3 | Uploaded own work with UploadWizard |
Itilizasyon fichye sa a
Pa gen okenn paj ki itilize dosye sa a.
Itilizasyon global fichye a
Wiki sa a yo sèvi ak fichye sa a:
- Itilizasyon sou en.wikipedia.org
- Itilizasyon sou eu.wikipedia.org
Rekipere depi « https://ht.wikipedia.org/wiki/Fichye:Inclinedthrow2.gif »