## 2018年1月12日金曜日

### 数学 - Python - 図形の変換の方法 - 線形写像・1次変換 – 平面の1次変換 - 1次変換の合成(x軸、原点、直線、対称移動、合成変換の行列、可換性について)

1. f の行列。

$\begin{array}{}A\left(\begin{array}{c}x\\ y\end{array}\right)\end{array}=\left(\begin{array}{c}x\\ -y\end{array}\right)\left(\begin{array}{cc}a& b\\ c& d\end{array}\right)\left(\begin{array}{c}x\\ y\end{array}\right)=\left(\begin{array}{c}x\\ -y\end{array}\right)\\ ax+by=x\\ cx+\mathrm{dy}=-y\\ a=1\\ b=0\\ c=0\\ d=-1\\ A=\left(\begin{array}{cc}1& 0\\ 0& -1\end{array}\right)$

g の行列。

$\begin{array}{}A\left(\begin{array}{c}x\\ y\end{array}\right)\end{array}=\left(\begin{array}{c}-x\\ -y\end{array}\right)A=\left(\begin{array}{cc}-1& 0\\ 0& -1\end{array}\right)$

h の行列。

$A=\left(\begin{array}{cc}0& 1\\ 1& 0\end{array}\right)$
$\left(\begin{array}{cc}1& 0\\ 0& -1\end{array}\right)\left(\begin{array}{cc}-1& 0\\ 0& -1\end{array}\right)=\left(\begin{array}{cc}-1& 0\\ 0& 1\end{array}\right)$

2. $\left(\begin{array}{cc}-1& 0\\ 0& -1\end{array}\right)\left(\begin{array}{cc}1& 0\\ 0& -1\end{array}\right)=\left(\begin{array}{cc}-1& 0\\ 0& 1\end{array}\right)$

3. $\left(\begin{array}{cc}0& 1\\ 1& 0\end{array}\right)\left(\begin{array}{cc}1& 0\\ 0& -1\end{array}\right)=\left(\begin{array}{cc}0& -1\\ 1& 0\end{array}\right)$

4. $\left(\begin{array}{cc}1& 0\\ 0& -1\end{array}\right)\left(\begin{array}{cc}0& 1\\ 1& 0\end{array}\right)=\left(\begin{array}{cc}0& 1\\ -1& 0\end{array}\right)$

5. $\left(\begin{array}{cc}-1& 0\\ 0& -1\end{array}\right)\left(\begin{array}{cc}0& 1\\ 1& 0\end{array}\right)=\left(\begin{array}{cc}0& -1\\ -1& 0\end{array}\right)$

6. $\left(\begin{array}{cc}0& 1\\ 1& 0\end{array}\right)\left(\begin{array}{cc}-1& 0\\ 0& -1\end{array}\right)=\left(\begin{array}{cc}0& -1\\ -1& 0\end{array}\right)$

コード(Emacs)

Python 3

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

f = Matrix([[1, 0],
[0, -1]])
g = Matrix([[-1, 0],
[0, -1]])
h = Matrix([[0, 1],
[1, 0]])

for i, t in enumerate([f * g, g * f, h * f, f * h, g * h, h * g], 1):
print(f'({i})')
pprint(t)
print()


$./sample6.py (1) ⎡-1 0⎤ ⎢ ⎥ ⎣0 1⎦ (2) ⎡-1 0⎤ ⎢ ⎥ ⎣0 1⎦ (3) ⎡0 -1⎤ ⎢ ⎥ ⎣1 0 ⎦ (4) ⎡0 1⎤ ⎢ ⎥ ⎣-1 0⎦ (5) ⎡0 -1⎤ ⎢ ⎥ ⎣-1 0 ⎦ (6) ⎡0 -1⎤ ⎢ ⎥ ⎣-1 0 ⎦$