## 2019年8月24日土曜日

### 数学 - Python - 解析学 - 各種の初等関数 - 三角関数 - 正弦(sine)・余弦(cosine)、平面幾何学の定理

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

コード

Python 3

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import pprint, symbols, sin, cos, pi, plot

print('1.')

class MyTest(TestCase):
def setUp(self):
pass

def tearDown(self):
pass

def test(self):
theta = symbols('θ')
self.assertEqual(sin(pi / 2 - theta), cos(theta))
self.assertEqual(cos(pi / 2 - theta), sin(theta))

if __name__ == '__main__':
theta = symbols('θ')
p = plot(sin(-theta), cos(theta),
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('sample1.png')
main()


C:\Users\...>py sample1.py
1.
.
----------------------------------------------------------------------
Ran 1 test in 0.011s

OK

C:\Users\...>