diff options
| author | Andrew Guschin <guschin.drew@gmail.com> | 2022-03-25 21:00:44 +0400 |
|---|---|---|
| committer | Andrew Guschin <guschin.drew@gmail.com> | 2022-03-25 21:00:44 +0400 |
| commit | ef6abff6f63e2b79ee9e2c4e417503d23e1e65a3 (patch) | |
| tree | 2a011387a9b19715e634f830b74f25138411a1a9 | |
| parent | e30b0473acca21a225cfcbdb661034661914f98f (diff) | |
Дописал третью лабу
| -rw-r--r-- | lab3/lab3.py | 44 | ||||
| -rw-r--r-- | lab3/report/images/test1.png | bin | 0 -> 500914 bytes | |||
| -rw-r--r-- | lab3/report/images/test2.png | bin | 0 -> 525847 bytes | |||
| -rw-r--r-- | lab3/report/images/test3.png | bin | 0 -> 558458 bytes | |||
| -rw-r--r-- | lab3/report/images/test4.png | bin | 0 -> 535990 bytes | |||
| -rw-r--r-- | lab3/report/images/test5.png | bin | 0 -> 510211 bytes | |||
| -rw-r--r-- | lab3/report/images/test6.png | bin | 0 -> 480668 bytes | |||
| -rw-r--r-- | lab3/report/lab3.tex | 37 |
8 files changed, 60 insertions, 21 deletions
diff --git a/lab3/lab3.py b/lab3/lab3.py index 8921b7d..bb41579 100644 --- a/lab3/lab3.py +++ b/lab3/lab3.py @@ -93,9 +93,12 @@ def check_operation(): if check_distributivity(cayley, cayley2, elements): status.append("дистрибутивность") - print("Заданная бинарная операция обладает следующими свойствами:") - for i in status: - print(i) + if status: + print("Заданная бинарная операция обладает следующими свойствами:") + for i in status: + print(i) + else: + print("Заданная бинарная операция не обладает никакими свойствами") ###################### @@ -130,33 +133,33 @@ def check_relations(): a.append(line) return np.array(a, dtype=bool) - n = input("Введите размерность проверяемых отношений: ") + n = int(input("Введите размерность проверяемых отношений: ")) - print("Введите бинарное отношение A") + print("Введите бинарное отношение A:") a = read_array(n) - print("Введите бинарное отношение B") + print("Введите бинарное отношение B:") b = read_array(n) print("Объединение бинарных отношений:") - print(np.int(a + b)) + print((a + b).astype(int)) print("Пересечение бинарных отношений:") - print(np.int(np.multiply(a, b))) + print(np.multiply(a, b).astype(int)) print("Дополнение бинарного отношения A:") - print(np.int(1 - a)) + print((1 - a).astype(int)) print("Дополнение бинарного отношения B:") - print(np.int(1 - b)) + print((1 - b).astype(int)) print("Бинарное отношение, обратное A:") - print(np.int(np.transpose(a))) + print(np.transpose(a).astype(int)) print("Бинарное отношение, обратное B:") - print(np.int(np.transpose(b))) + print(np.transpose(b).astype(int)) print("Композиция отношений:") - print(np.int(np.matmul(a, b))) + print(np.matmul(a, b).astype(int)) ######################## # Операции с матрицами # @@ -182,9 +185,9 @@ def check_matrices(): def read_matrix(n: int, m: int) -> np.array: a = [] for _ in range(n): - line = list(map(int, input().strip().split())) + line = list(map(float, input().strip().split())) a.append(line) - return np.array(a, dtype=bool) + return np.array(a, dtype=float) print("1 - Сложение матриц;") print("2 - Умножение матрицы на скаляр;") @@ -202,8 +205,8 @@ def check_matrices(): print("Сумма матриц:") print(mat_add(a, b)) elif test == 2: - n, m = map(int, input("Введите размерность матриц: ").split()) - print("Введите матрицу A:") + n, m = map(int, input("Введите размерность матрицы: ").split()) + print("Введите матрицу:") a = read_matrix(n, m) alpha = float(input("Введите скаляр: ")) @@ -211,17 +214,18 @@ def check_matrices(): print("Результат:") print(mat_scale(a, alpha)) elif test == 3: - n, m = map(int, input("Введите размерность матриц: ").split()) - print("Введите матрицу A:") + n, m = map(int, input("Введите размерность матрицы: ").split()) + print("Введите матрицу:") a = read_matrix(n, m) print("Результат:") print(mat_transpose(a)) elif test == 4: - n, m = map(int, input("Введите размерность матриц: ").split()) + n, m = map(int, input("Введите размерность матрицы A: ").split()) print("Введите матрицу A:") a = read_matrix(n, m) + n, m = map(int, input("Введите размерность матрицы B: ").split()) print("Введите матрицу B:") b = read_matrix(n, m) diff --git a/lab3/report/images/test1.png b/lab3/report/images/test1.png Binary files differnew file mode 100644 index 0000000..3f36d81 --- /dev/null +++ b/lab3/report/images/test1.png diff --git a/lab3/report/images/test2.png b/lab3/report/images/test2.png Binary files differnew file mode 100644 index 0000000..c60affb --- /dev/null +++ b/lab3/report/images/test2.png diff --git a/lab3/report/images/test3.png b/lab3/report/images/test3.png Binary files differnew file mode 100644 index 0000000..c9068c7 --- /dev/null +++ b/lab3/report/images/test3.png diff --git a/lab3/report/images/test4.png b/lab3/report/images/test4.png Binary files differnew file mode 100644 index 0000000..312d91f --- /dev/null +++ b/lab3/report/images/test4.png diff --git a/lab3/report/images/test5.png b/lab3/report/images/test5.png Binary files differnew file mode 100644 index 0000000..81ae561 --- /dev/null +++ b/lab3/report/images/test5.png diff --git a/lab3/report/images/test6.png b/lab3/report/images/test6.png Binary files differnew file mode 100644 index 0000000..2fcac37 --- /dev/null +++ b/lab3/report/images/test6.png diff --git a/lab3/report/lab3.tex b/lab3/report/lab3.tex index 6faca04..a06a190 100644 --- a/lab3/report/lab3.tex +++ b/lab3/report/lab3.tex @@ -345,7 +345,42 @@ $B = (b_{ij})$ размерности $N \times M$. \section{Результаты тестирования} -текст +\begin{figure}[H] + \centering + \includegraphics[width=0.8\textwidth]{test1.png} + \caption{Проверка свойств некоторой бинарной операции} +\end{figure} + +\begin{figure}[H] + \centering + \includegraphics[width=0.8\textwidth]{test2.png} + \caption{Проверка свойства транзитивности для двух операций} +\end{figure} + +\begin{figure}[H] + \centering + \includegraphics[width=0.8\textwidth]{test3.png} + \caption{Выполнение основных операций над бинарными отношениями} +\end{figure} + +\begin{figure}[H] + \centering + \includegraphics[width=0.8\textwidth]{test4.png} + \caption{Проверка операции умножения двух матриц} +\end{figure} + +\begin{figure}[H] + \centering + \includegraphics[width=0.8\textwidth]{test5.png} + \caption{Проверка операции транспонирования матрицы} +\end{figure} + +\begin{figure}[H] + \centering + \includegraphics[width=0.8\textwidth]{test6.png} + \caption{Ответы на задачи (Вариант 6)} +\end{figure} + \conclusion |