summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--1.py26
-rw-r--r--libsolve.py13
-rw-r--r--phw2.tex54
3 files changed, 91 insertions, 2 deletions
diff --git a/1.py b/1.py
new file mode 100644
index 0000000..d920667
--- /dev/null
+++ b/1.py
@@ -0,0 +1,26 @@
+from libsolve import Permutation
+from itertools import permutations
+
+PRINT_LATEX = False
+
+# (1 2 5 8 3 7 6)(4)
+rhs = Permutation([1, 4, 6, 3, 7, 0, 5, 2])
+
+# (2 8 5 7 3 6 4)(1)
+lhs = Permutation([0, 7, 5, 1, 6, 3, 2, 4])
+
+for perm in permutations(range(8), 8):
+ p = Permutation(perm)
+
+ id = list(range(8))
+ right = rhs.apply(id)
+ left = p.apply(lhs.apply(p.apply(id)))
+ if left == right:
+ if PRINT_LATEX:
+ print('\\begin{pmatrix}', end='')
+ print(*range(1, 9), sep=' & ', end='')
+ print(*map(lambda i: f'{i + 1}', p.perm),
+ sep=' & ',
+ end='\\end{pmatrix}\\\\\n')
+ else:
+ print(p.perm)
diff --git a/libsolve.py b/libsolve.py
index 61d7f40..af72264 100644
--- a/libsolve.py
+++ b/libsolve.py
@@ -267,3 +267,16 @@ class Matrix:
row.set_hints(max_hints)
return '\n'.join(repr(row) for row in self.rows)
+
+
+class Permutation:
+ def __init__(self, perm: Iterable):
+ self.perm = list(perm)
+
+ def apply(self, now: list):
+ assert len(self.perm) == len(now)
+ res = [0] * len(self.perm)
+ for i in range(len(self.perm)):
+ res[self.perm[i]] = now[i]
+
+ return res
diff --git a/phw2.tex b/phw2.tex
index 1138761..ad54315 100644
--- a/phw2.tex
+++ b/phw2.tex
@@ -3,6 +3,7 @@
%\usepackage[utf8]{inputenc}
%\usepackage[russian]{babel}
+\usepackage{datetime2}
\input{intro}
@@ -21,15 +22,64 @@
\title{ИДЗ-2 по линейной алгебре}
\author{Шарафатдинов Камиль БПМИ-192}
-\date{\today}
+\date{\DTMnow}
% -- Here bet dragons --
\begin{document}
+
\maketitle
+\begin{center}
+\url{https://git.fcked.net/alg2}
+\end{center}
%\section*{Abstract}
\clearpage
+\question{1}{
+ \[
+ \sigma(2\ 8\ 5\ 7\ 3\ 6\ 4)\sigma = \left(
+ \begin{pmatrix}
+ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
+ 3 & 7 & 2 & 4 & 6 & 8 & 5 & 1
+ \end{pmatrix}^{-1}
+ \begin{pmatrix}
+ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
+ 4 & 6 & 8 & 7 & 3 & 1 & 2 & 5
+ \end{pmatrix}^{15}
+ \right)^{180}
+ \]
+}
+
+ \begin{gather*}
+ \begin{pmatrix}
+ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
+ 3 & 7 & 2 & 4 & 6 & 8 & 5 & 1
+ \end{pmatrix}^{-1} =
+ \begin{pmatrix}
+ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
+ 8 & 3 & 1 & 4 & 7 & 5 & 2 & 6
+ \end{pmatrix} = (1\ 8\ 6\ 5\ 7\ 2\ 3)(4)\\
+ \begin{pmatrix}
+ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
+ 4 & 6 & 8 & 7 & 3 & 1 & 2 & 5
+ \end{pmatrix}^{15} = (1\ 4\ 7\ 2\ 6)(3\ 8\ 5)^{15} = id_8\\\\
+ ((1\ 8\ 6\ 5\ 7\ 2\ 3)(4))^{180} =
+ ((1\ 8\ 6\ 5\ 7\ 2\ 3)(4))^5 =
+ (1\ 2\ 5\ 8\ 3\ 7\ 6)(4)
+ \end{gather*}
+
+ Теперь просто переберем (\texttt{1.py}) все перестановки и выпишем подходящие:
+ \begin{gather*}
+ \begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\3 & 6 & 7 & 5 & 8 & 2 & 4 & 1\end{pmatrix},
+ \begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\3 & 6 & 8 & 5 & 7 & 2 & 4 & 1\end{pmatrix}\\
+ \begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\4 & 2 & 7 & 1 & 8 & 6 & 3 & 5\end{pmatrix},
+ \begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\4 & 2 & 8 & 1 & 7 & 6 & 3 & 5\end{pmatrix}\\
+ \begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\5 & 1 & 7 & 3 & 8 & 4 & 2 & 6\end{pmatrix},
+ \begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\5 & 1 & 8 & 3 & 7 & 4 & 2 & 6\end{pmatrix}\\
+ \begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\6 & 3 & 7 & 2 & 8 & 5 & 1 & 4\end{pmatrix},
+ \begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\6 & 3 & 8 & 2 & 7 & 5 & 1 & 4\end{pmatrix}\\
+ \end{gather*}
+
\question{2}{
\[
\begin{pmatrix}
@@ -85,7 +135,7 @@
-1 & -2 & 2 & -2 & 0 & 1 & 0 & 0\\
1 & 2 & -1 & 3 & 0 & 0 & 1 & 0\\
-1 & -2 & 1 & -2 & 0 & 0 & 0 & 1
- \end{pmatrix} \overset{\texttt{main2.py}}\sim % TODO
+ \end{pmatrix} \overset{\texttt{2.py}}\sim % TODO
\begin{pmatrix}[cccc|cccc]
1 & 0 & 0 & 0 & 2 & 1 & 0 & 0\\
0 & 1 & 0 & 0 & -1 & 0 & -1 & -2\\