## 2019年3月18日月曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 三角関数(正弦と余弦、近似値(小数第3位まで))

1. テイラー展開は手動で、小数第３位までの計算はPythonに任せることに。

1. $\begin{array}{}\mathrm{sin}3{1}^{\circ }\\ =\mathrm{sin}\left(\frac{\pi }{6}+\frac{\pi }{180}\right)\\ \fallingdotseq \mathrm{sin}\frac{\pi }{6}+\left(\mathrm{cos}\frac{\pi }{6}\right)\left(\left(\frac{\pi }{6}+\frac{\pi }{180}\right)-\frac{\pi }{6}\right)\\ =\frac{1}{2}+\frac{\sqrt{3}}{2}·\frac{\pi }{180}\end{array}$

2. $\begin{array}{}\mathrm{cos}3{1}^{\circ }\\ =\mathrm{cos}\left(\frac{\pi }{6}+\frac{\pi }{180}\right)\\ \fallingdotseq \mathrm{cos}\frac{\pi }{6}-\left(\mathrm{sin}\frac{\pi }{6}\right)\left(\left(\frac{\pi }{6}+\frac{\pi }{180}\right)-\frac{\pi }{6}\right)\\ =\frac{\sqrt{3}}{2}-\frac{1}{2}·\frac{\pi }{180}\end{array}$

3. $\begin{array}{}\mathrm{sin}4{7}^{\circ }\\ =\mathrm{sin}\left(\frac{\pi }{4}+\frac{2\pi }{180}\right)\\ \fallingdotseq \mathrm{sin}\frac{\pi }{4}+\left(\mathrm{cos}\frac{\pi }{4}\right)\left(\left(\frac{\pi }{4}+\frac{2\pi }{180}\right)-\frac{\pi }{4}\right)\\ =\frac{1}{\sqrt{2}}+\frac{1}{\sqrt{2}}·\frac{\pi }{90}\end{array}$

4. $\begin{array}{}\mathrm{cos}4{7}^{0}\\ \fallingdotseq \mathrm{cos}\frac{\pi }{4}-\left(\mathrm{sin}\frac{\pi }{4}\right)\frac{\pi }{90}\\ =\frac{1}{\sqrt{2}}-\frac{1}{\sqrt{2}}·\frac{\pi }{90}\end{array}$

5. $\begin{array}{}\mathrm{sin}3{2}^{\circ }\\ =\mathrm{sin}\left(\frac{\pi }{6}+\frac{2\pi }{180}\right)\\ \fallingdotseq \mathrm{sin}\frac{\pi }{6}+\left(\mathrm{cos}\frac{\pi }{6}\right)\frac{\pi }{90}\\ =\frac{1}{2}+\frac{\sqrt{3}}{2}·\frac{\pi }{90}\end{array}$

6. $\begin{array}{}\mathrm{cos}3{2}^{\circ }\\ \fallingdotseq \mathrm{cos}\frac{\pi }{6}-\left(\mathrm{sin}\frac{\pi }{6}\right)\frac{\pi }{90}\\ =\frac{\sqrt{3}}{2}-\frac{1}{2}·\frac{\pi }{90}\end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, Rational, sqrt, pi

print('8.')

l = [Rational(1, 2) + sqrt(3) / 2 * pi / 180,
sqrt(3) - pi / (2 * 180),
1 / sqrt(2) + 1 / sqrt(2) * pi / 90,
1 / sqrt(2) - 1 / sqrt(2) * pi / 90,
Rational(1, 2) + sqrt(3) / 2 * pi / 90,
sqrt(3) / 2 - pi / (2 * 90)]

for i, o in enumerate(l):
print(f'({chr(ord("a") + i)})')
for s in [o, float(o), round(float(o), 3)]:
pprint(s)
print()
print()


C:\Users\...>py -3 sample8.py
8.
(a)
√3⋅π   1
──── + ─
360    2

0.5151149947019518

0.515

(b)
π
- ─── + √3
360

1.7233241613089056

1.723

(c)
√2⋅π   √2
──── + ──
180    2

0.7317894641763162

0.732

(d)
√2⋅π   √2
- ──── + ──
180    2

0.6824240981967788

0.682

(e)
√3⋅π   1
──── + ─
180    2

0.5302299894039036

0.53

(f)
π    √3
- ─── + ──
180   2

0.8485721112644954

0.849

C:\Users\...>