## 2020年3月19日木曜日

### 数学 - Python - 代数学 - 1次方程式, 2次方程式 - 複素数、和の共役と共役の和、積の共役と共役の積、商の共役と共役の商

1. 2つの複素数を

$\begin{array}{l}\alpha =a+bi\\ \beta =c+di\\ a,b,c,d\in \text{ℝ}\end{array}$

とおく。

$\begin{array}{l}\frac{}{\alpha +\beta }\\ =\stackrel{-}{\left(a+c\right)+\left(b+d\right)i}\\ =\left(a+c\right)-\left(b+d\right)i\\ =\left(a-bi\right)+\left(c-di\right)\\ =\stackrel{-}{a+bi}+\stackrel{-}{c+di}\\ =\stackrel{-}{a}+\stackrel{-}{\beta }\end{array}$

2. $\begin{array}{l}\stackrel{-}{\alpha \beta }\\ =\stackrel{-}{\left(a+bi\right)\left(c+di\right)}\\ =\stackrel{-}{\left(ac-bd\right)+\left(ad+bc\right)i}\\ =\left(ac-bd\right)-\left(ad+bc\right)i\\ \stackrel{-}{\alpha }\stackrel{-}{\beta }\\ =\left(a-bi\right)\left(c-di\right)\\ =\left(ac-bd\right)-\left(ad+bc\right)i\\ \stackrel{-}{\alpha \beta }=\stackrel{-}{\alpha }\stackrel{-}{\beta }\end{array}$

3. $\begin{array}{l}\beta \ne 0\\ ¬\left(c=0\wedge d=0\right)\\ \frac{}{\left(\frac{\alpha }{\beta }\right)}\\ =\stackrel{-}{\left(\frac{a+bi}{c+di}\right)}\\ =\frac{\stackrel{-}{\left(a+bi\right)\left(c-di\right)}}{{c}^{2}+{d}^{2}}\\ =\frac{1}{{c}^{2}+{d}^{2}}\left(a-bi\right)\left(c+di\right)\\ \frac{\stackrel{-}{\alpha }}{\stackrel{-}{B}}\\ =\frac{a-bi}{c-di}\\ =\frac{1}{{c}^{2}+{d}^{2}}\left(a-bi\right)\left(c+di\right)\end{array}$

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols

print('13.')

a, b = symbols('a, b', imag=True)

class MyTestCase(TestCase):
self.assertEqual((a + b).conjugate(), a.conjugate() + b.conjugate())

def test_mul(self):
self.assertEqual((a * b).conjugate(), a.conjugate() * b.conjugate())

def test_div(self):
self.assertEqual((a / b).conjugate(), a.conjugate() / b.conjugate())

if __name__ == "__main__":
main()


% ./sample13.py -v
13.