2020年3月5日木曜日

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

1. $\begin{array}{l}2\\ =2\left(\mathrm{cos}\left(0+2n\pi \right)+i\mathrm{sin}\left(0+2n\pi \right)\right)\\ ={e}^{\mathrm{log}2}{e}^{2n\pi i}\\ ={e}^{\mathrm{log}2+2n\pi i}\\ n\in \text{ℤ}\end{array}$

よって、

$z=\mathrm{log}2+2n\pi i$

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

3. $\begin{array}{l}i\\ =\mathrm{cos}\left(\frac{\pi }{2}+2n\pi \right)+i\mathrm{sin}\left(\frac{\pi }{2}+2n\pi \right)\\ z=\left(\frac{\pi }{2}+2n\pi \right)i\end{array}$

4. $\begin{array}{l}-1-i\\ =\sqrt{2}\left(-\frac{1}{\sqrt{2}}-\frac{1}{\sqrt{2}}i\right)\\ =\sqrt{2}\left(\mathrm{cos}\left(\frac{5}{4}\pi +2n\pi \right)+i\mathrm{sin}\left(\frac{5}{4}\pi +2n\pi \right)\right)\\ z=\mathrm{log}\sqrt{2}+\left(\frac{5}{4}\pi +2n\pi \right)i\end{array}$

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import I, pi, sqrt, exp, log, symbols

print('2.')

class MyTestCase(TestCase):
def test(self):
n = symbols('n', integer=True)
ys = [(2, 0), (-1, 0), (0, 1), (-1, -1)]
zs = [log(2) + 2 * n * pi * I,
(pi + 2 * n * pi) * I,
(pi / 2 + 2 * n * pi) * I,
log(sqrt(2)) + (5 * pi / 4 + 2 * n * pi) * I]
for i, ((a, b), z) in enumerate(zip(ys, zs), 1):
print(f'({i})')
for n0 in range(-5, 6):
c, d = exp(z.subs({n: n0})).as_real_imag()
self.assertEqual(a, c)
self.assertEqual(b, d)

if __name__ == "__main__":
main()


% ./sample2.py
2.
(1)
(2)
(3)
(4)
.
----------------------------------------------------------------------
Ran 1 test in 0.113s

OK
%