## 2019年11月28日木曜日

### 数学 - Python - 円の中にひそむ関数 - 三角関数 - 加法定理 - 三角関数の諸公式の正接 - 正弦と余弦と正接、半角

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

コード

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

print('29.')

x = symbols('x')
t = tan(x / 2)

p = plot(2 * t / (1 + t ** 2),
(1 - t ** 2) / (1 + t ** 2),
ylim=(-10, 10),
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.show()
p.save(f'sample29.png')


% ./sample29.py
29.
%