## 2018年1月10日水曜日

### 数学 - Python - 線型代数 - 行列式 - 行列式の計算(行に関する展開、列に関する展開、4次)

1. $\begin{array}{}abc+abc+abc-{a}^{3}-{b}^{3}-{c}^{3}\\ =3abc-{a}^{3}-{b}^{3}-{c}^{3}\end{array}$

2. $\begin{array}{}1-abc+abc+{c}^{2}+{a}^{2}+{b}^{2}\\ ={a}^{2}+{b}^{2}+{c}^{2}+1\end{array}$

3. $\begin{array}{}\mathrm{det}\left(\begin{array}{ccc}a+b-c& c& 0\\ a-b-c& b+c& a-b-c\\ 0& b& a-b+c\end{array}\right)\end{array}=\mathrm{det}\left(\begin{array}{ccc}a+b-c& c& 0\\ a-b-c& c& -2c\\ 0& b& a-b+c\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{ccc}a+b-c& c& 0\\ -2b& 0& -2c\\ 0& b& a-b+c\end{array}\right)\\ =-\left(a+b-c\right)\left(-2c\right)b-c\left(-2b\right)\left(a-b+c\right)\\ =2bc\left(a+b-c\right)+2bc\left(a-b+c\right)\\ =4abc$

4. $\mathrm{det}\left(\begin{array}{cccc}1& 1& 1& 1\\ 0& x& 0& 0\\ 0& 0& y& o\\ 0& 0& 0& z\end{array}\right)=xyz$

5. $\begin{array}{}\mathrm{det}\left(\begin{array}{cccc}1& a& b& c+d\\ 0& b-a& c-b& a-c\\ 0& c-b& d-c& b-d\\ 0& d-c& a-d& c-a\end{array}\right)\end{array}=\mathrm{det}\left(\begin{array}{ccc}-a+c& c-b& a-c\\ -b+d& d-c& b-d\\ -c+a& a-d& c-a\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{ccc}0& c-b& a-c\\ 0& d-c& b-d\\ 0& a-d& c-a\end{array}\right)\\ =0$

コード(Emacs)

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, Matrix

a, b, c, d = symbols('a, b, c, d')
X = Matrix([[1, a, b, c + d],
[1, b, c, d + a],
[1, c, d, a + b],
[1, d, a, b + c]])

for t in [X, X.det()]:
pprint(t)
print()


$./sample3.py ⎡1 a b c + d⎤ ⎢ ⎥ ⎢1 b c a + d⎥ ⎢ ⎥ ⎢1 c d a + b⎥ ⎢ ⎥ ⎣1 d a b + c⎦ 0$