## 2020年3月4日水曜日

### 数学 - Python - 解析学 - 関数列と関数級数 - 複素整級数(指数関数・三角関数再論) - 複素変数の指数関数と三角関数との間の関係式(正弦と余弦)

• $\begin{array}{l}{e}^{\frac{\pi }{2}i}\\ =\mathrm{cos}\frac{\pi }{2}+i\mathrm{sin}\frac{\pi }{2}\\ =i\end{array}$

• $\begin{array}{l}{e}^{-\pi i}\\ =\mathrm{cos}\left(-\pi \right)+i\mathrm{sin}\left(-\pi \right)\\ =-1\end{array}$

• $\begin{array}{l}{e}^{\frac{3}{4}\pi i}\\ =\mathrm{cos}\frac{3}{4}\pi +i\mathrm{sin}\frac{3}{4}\pi \\ =-\frac{1}{\sqrt{2}}+\frac{1}{\sqrt{2}}i\end{array}$

• $\begin{array}{l}{e}^{-\frac{\pi i}{3}}\\ =\mathrm{cos}\left(-\frac{\pi }{3}\right)+i\mathrm{sin}\left(-\frac{\pi }{3}\right)\\ =\frac{1}{2}-\frac{\sqrt{3}}{2}i\end{array}$

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import I, pi, Rational, sqrt, exp
print('1.')

class MyTestCase(TestCase):
def test(self):
xs = [pi * I / 2,
-pi * I,
3 * pi / 4 * I,
- pi * I / 3]
ys = [(0, 1),
(-1, 0),
(-1 / sqrt(2), 1 / sqrt(2)),
(Rational(1, 2), -sqrt(3) / 2)]
for i, (x, (c, d)) in enumerate(zip(xs, ys), 1):
print(f'({i})')
a, b = exp(x).as_real_imag()
self.assertEqual(a, c)
self.assertEqual(b, d)

if __name__ == "__main__":
main()


% ./sample1.py -v
1.
test (__main__.MyTestCase) ... (1)
(2)
(3)
(4)
ok

----------------------------------------------------------------------
Ran 1 test in 0.065s

OK
%