学習環境
- Surface
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
新装版 数学読本2 (松坂 和夫(著)、岩波書店) の第8章(円の中にひそむ関数 - 三角関数)、8.1(一般角と三角関数)、三角関数の周期性の問10の解答を求めてみる。
周期について。
正弦についての 関数のグラフ。
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, sin, cos, pi, tan, plot
print('10.')
x = symbols('x')
sins = [sin(x), 3 * sin(x), sin(3 * x), sin(x / 2),
sin(x - pi), sin(x + pi / 4)]
coses = [cos(x), 3 * cos(x) / 2, cos(2 * x), cos(x - pi / 4)]
tans = [tan(x), tan(x) / 2, tan(2 * x), tan(x + pi / 6)]
xs = [10, 10, 5]
for i, (fs, x0) in enumerate(zip([sins, coses, tans], xs)):
p = plot(*[(f, (x, -x0, x0)) for f in fs],
ylim=(-5, 5),
legend=True,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
for s, color in zip(p, colors):
s.line_color = color
p.save(f'sample10_{i}.png')
p.show()
入出力結果(Zsh、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
% ./sample10.py 10. %
グラフの描画。
正弦
余弦
正接
0 コメント:
コメントを投稿