ライブラリの import
In [1]:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import *
# 以下はグラフを SVG で Notebook にインライン表示させる設定
%config InlineBackend.figure_formats = ['svg']
In [2]:
# ax を使う際の最初のおまじない
fig, ax = plt.subplots(figsize = [6.4, 6.4])
# アスペクトを equal に
ax.set_aspect('equal')
# ticks はつけない
ax.set_xticks([])
ax.set_yticks([])
# 表示範囲
ax.axis([-2.5, 2.5, -4, 1])
# x軸 y軸は dashed に。
ax.axhline(0, c='gray', ls='--', lw=0.5)
ax.axvline(0, c='gray', ls='--', lw=0.5)
# 30度に振れた単振り子
th = np.radians(30)
# ワイヤーの長さ
ell = 3
# ワイヤー
ax.plot([0, ell*np.sin(th)], [0, -ell*np.cos(th)], color = 'k')
ax.plot([0, -ell*np.sin(th)], [0, -ell*np.cos(th)], color = 'k')
# おもり
ax.scatter([ ell*np.sin(th)], [-ell*np.cos(th)], color='red')
ax.scatter([-ell*np.sin(th)], [-ell*np.cos(th)], color='red')
# おもりの軌跡の円弧
p = Arc((0, 0), 6, 6, theta1 = 240, theta2 = 300,
color = 'k', lw = 0.5,ls='--')
ax.add_patch(p)
# 円弧で角度
# (1)
p=Arc((0, 0), 1, 1, theta1 = 270, theta2 = 300,
color = 'b', lw = 1.5)
ax.add_patch(p)
ax.text(0.15, -0.63, '(1)', color = 'b', ha = 'center')
# (2)
p=Arc((0, 0), 2, 2, theta1 = 240, theta2 = 300,
color = 'red', lw = 1.5)
ax.add_patch(p)
ax.text(0.1, -1.15, '(2)', color = 'red', ha = 'center')
# 直線で水平距離
# (3)
ax.plot([0, ell*np.sin(th)],
[-ell*np.cos(th), -ell*np.cos(th)], c='tab:blue')
ax.text(0.6, -2.55, '(3)', c='tab:blue')
# (4)
ax.plot([-ell*np.sin(th), ell*np.sin(th)],
[-2.63, -2.63], c='tab:orange')
ax.text(-0.25, -2.8, '(4)', c='tab:orange')
# タイトル
ax.set_title('単振り子の「振幅」はどれ?');
問題:単振り子の「振幅」は次のうちのどれ?
- (1) の角度,すなわち鉛直下向きをゼロとしたときの振れ角の最大値
- (2) の角度,すなわち (1) の角度の2倍
- (3) の長さ,すなわち振り子の支点からの水平方向の長さの最大値
- (4) の長さ,すなわち (3) の長さの2倍