## 2019年10月27日日曜日

### 数学 - Python - 円の中にひそむ関数 - 三角関数 - 一般角と三角関数 - 正接 - 定義、象限、符号

1. $\mathrm{tan}\frac{2}{3}\pi =-\sqrt{3}$

2. $\mathrm{tan}\frac{5}{4}\pi =1$

3. $\begin{array}{l}\mathrm{tan}\left(-\frac{\pi }{6}\right)\\ =-\mathrm{tan}\frac{\pi }{6}\\ =-\frac{1}{\sqrt{3}}\end{array}$

4. $\begin{array}{l}\mathrm{tan}\left(-\frac{22}{3}\pi \right)\\ =\mathrm{tan}\left(\frac{2}{3}\pi \right)\\ =-\sqrt{3}\end{array}$

5. $\begin{array}{l}\mathrm{tan}35\pi \\ =\mathrm{tan}0\\ =0\end{array}$

コード

Python 3

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

print('8.')

theta = symbols('θ')

x = symbols('x')
thetas = [2 * pi / 3, 5 * pi / 4, -pi / 6, -22 * pi / 3, 35 * pi]
fs = [tan(t0) * x for t0 in thetas]
g = sqrt(1 - x ** 2)

p = plot((g, (x, -1, 1)),
(-g, (x, -1, 1)),
*[(f, (x, -2, 2)) for f in fs],
ylim=(-2, 2),
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'sample8.png')


% ./sample8.py
8.
%