跳至內容

File:Mplwp ballistic trajectories velocities.svg

頁面內容不支援其他語言。
這個檔案來自維基共享資源
維基百科,自由的百科全書

原始檔案(SVG 檔案,表面大小:600 × 400 像素,檔案大小:29 KB)


摘要

描述
English: Plot of a ballistic trajectory with air resistance. The trajectory follows the differential equation with initial conditions .

The parameters are:

  • , ,
  • The initial velocity takes the values , , , ,
The differential equation is solved numerically using Scipy odeint.
日期
來源 自己的作品
作者 Geek3
SVG開發
InfoField
 
SVG檔案的原始碼通過W3C驗證
 
向量圖形使用mplwp創作。
原始碼
InfoField

mplwp source code

The plot was generated with mplwp 1.0
#!/usr/bin/python
# -*- coding: utf8 -*-

import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from math import *

code_website = 'http://commons.wikimedia.org/wiki/User:Geek3/mplwp'
try:
    import mplwp
except ImportError, er:
    print 'ImportError:', er
    print 'You need to download mplwp.py from', code_website
    exit(1)

name = 'mplwp_ballistic_trajectories_velocities.svg'
fig = mplwp.fig_standard(mpl)

xlim = 0,2.6; fig.gca().set_xlim(xlim)
ylim = 0,2.6*355/515.; fig.gca().set_ylim(ylim)
fig.gca().xaxis.set_major_locator(mpl.ticker.MultipleLocator(0.4))
fig.gca().yaxis.set_major_locator(mpl.ticker.MultipleLocator(0.4))

from scipy.integrate import odeint
from scipy.optimize import brentq
def ballistic(g, k, xy0, v0, alpha0, tt):
    # use a four-dimensional vector function vec = [x, y, vx, vy]
    def dif(vec, t):
        v = sqrt(vec[2]**2 + vec[3]**2)
        return [vec[2], vec[3], -k*v*vec[2], -g -k*v*vec[3]]
    
    # solve the differential equation numerically
    vec = odeint(dif, [xy0[0], xy0[1], v0*cos(alpha0), v0*sin(alpha0)], tt)
    return vec[:,0], vec[:,1] # return x(tt) and y(tt)

g = 1.0
k = 1.0
alpha0 = pi/4
for v0 in np.linspace(0, 10, 6)[1:]:
    t1 = brentq(lambda t: ballistic(g,k,[0,0],v0,alpha0,[0,t])[1][1],0.1,5)
    t = np.linspace(0, t1, 5001)
    x, y = ballistic(g, k, [0, 0], v0, alpha0, t)
    while len(y) > 1 and y[-2] <= 0.0: x = x[:-1]; y = y[:-1]
    plt.plot(x, y,
        label=ur'$v_0=\,{:.0f}$'.format(v0))

mpl.rc('legend', borderaxespad=1.0)
plt.legend(loc='upper left').get_frame().set_alpha(0.9)
plt.savefig(name)
mplwp.postprocess(name)

授權條款

我,本作品的著作權持有者,決定用以下授權條款發佈本作品:
GNU head 已授權您依據自由軟體基金會發行的無固定段落、封面文字和封底文字GNU自由文件授權條款1.2版或任意後續版本,對本檔進行複製、傳播和/或修改。該協議的副本列在GNU自由文件授權條款中。
w:zh:共享創意
姓名標示
此檔案採用創用CC 姓名標示 3.0 未在地化版本授權條款。
您可以自由:
  • 分享 – 複製、發佈和傳播本作品
  • 重新修改 – 創作演繹作品
惟需遵照下列條件:
  • 姓名標示 – 您必須指名出正確的製作者,和提供授權條款的連結,以及表示是否有對內容上做出變更。您可以用任何合理的方式來行動,但不得以任何方式表明授權條款是對您許可或是由您所使用。
您可以選擇您需要的授權條款。

参看

說明

添加單行說明來描述出檔案所代表的內容

在此檔案描寫的項目

描繪內容

沒有維基數據項目的某些值

作者姓名字串 繁體中文 (已轉換拼寫):​Geek3
維基媒體使用者名稱 繁體中文 (已轉換拼寫):​Geek3

著作權狀態 繁體中文 (已轉換拼寫)

有著作權 繁體中文 (已轉換拼寫)

檔案來源 Chinese (Taiwan) (已轉換拼寫)

上傳者的原創作品 繁體中文 (已轉換拼寫)

檔案歷史

點選日期/時間以檢視該時間的檔案版本。

日期/時間縮⁠圖尺寸用戶備⁠註
目前2014年9月28日 (日) 14:00於 2014年9月28日 (日) 14:00 版本的縮圖600 × 400(29 KB)Geek3ballistic_trajectories_velocities plot by Geek3

下列頁面有用到此檔案:

全域檔案使用狀況

以下其他 wiki 使用了這個檔案:

詮釋資料