## 2019年8月26日月曜日

### 数学 - Python - 解析学 - 各種の初等関数 - 三角関数 - 正弦、余弦、正接、2倍角の公式

1. $\begin{array}{l}\mathrm{sin}\left(2\alpha \right)\\ =\mathrm{sin}\left(\alpha +\alpha \right)\\ =\mathrm{sin}\alpha \mathrm{cos}\alpha +\mathrm{cos}\alpha \mathrm{sin}\alpha \\ =2\mathrm{sin}\alpha \mathrm{cos}\alpha \\ \mathrm{cos}\left(2\alpha \right)\\ =\mathrm{cos}\left(\alpha +\alpha \right)\\ ={\mathrm{cos}}^{2}\alpha -{\mathrm{sin}}^{2}\alpha \\ ={\mathrm{cos}}^{2}\alpha -\left(1-{\mathrm{cos}}^{2}\alpha \right)\\ =2{\mathrm{cos}}^{2}\alpha -1\\ =\left(1-{\mathrm{sin}}^{2}\alpha \right)-{\mathrm{sin}}^{2}\alpha \\ =1-2{\mathrm{sin}}^{2}\alpha \\ \mathrm{tan}\left(2\alpha \right)\\ =\mathrm{tan}\left(\alpha +\alpha \right)\\ =\frac{\mathrm{tan}\alpha +\mathrm{tan}\alpha }{1-\mathrm{tan}\alpha \mathrm{tan}\alpha }\\ =\frac{2\mathrm{tan}\alpha }{1-{\mathrm{tan}}^{2}\alpha }\end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, sin, cos, tan, plot

print('3.')

theta = symbols('θ')
p = plot(sin(theta), sin(2 * theta),
cos(theta), cos(2 * theta),
tan(theta), tan(2 * theta),
(theta, -5, 5),
ylim=(-5, 5),
show=False,
legend=True)

colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

for o, color in zip(p, colors):
o.line_color = color

p.show()
p.save('sample3.png')


C:\Users\...>py sample3.py
3.

C:\Users\...>