## 2019年11月18日月曜日

### 数学 - Python - 円の中にひそむ関数 - 三角関数 - 加法定理 - 三角関数の合成 - 正弦と余弦、不等式の解

1. $\begin{array}{l}\mathrm{sin}\theta +\sqrt{3}\mathrm{cos}\theta <1\\ 2\left(\mathrm{sin}\theta \mathrm{cos}\frac{\pi }{3}+\mathrm{cos}\theta \mathrm{sin}\frac{\pi }{3}\right)<1\\ 2\mathrm{sin}\left(\theta +\frac{\pi }{3}\right)<1\\ \mathrm{sin}\left(\theta +\frac{\pi }{3}\right)<\frac{1}{2}\\ 0\le \theta <2\pi \\ \frac{\pi }{3}\le \theta +\frac{\pi }{3}<\frac{7}{3}\pi \\ \mathrm{sin}\left(\theta +\frac{\pi }{3}\right)<\frac{1}{2}\\ \frac{5}{6}\pi <\theta +\frac{\pi }{3}<\frac{7}{6}\pi \\ \frac{\pi }{2}\le \theta <\frac{5}{6}\pi \end{array}$

コード

#!/usr/bin/env python3
from sympy import pprint, symbols, sin, cos, sqrt, pi, plot, Interval
from sympy.solvers import solve_univariate_inequality

print('22.')

theta = symbols('θ', real=True)
f = sin(theta) + sqrt(3) * cos(theta)

p = plot(f, 1,
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'sample22.png')


% ./sample22.py
22.
%