excel happened
This commit is contained in:
@@ -220,6 +220,8 @@ class MainWindow(QMainWindow):
|
||||
|
||||
def setupUI(self):
|
||||
self.setWindowTitle("Лабораторная работа №3")
|
||||
self.resize(700, 200)
|
||||
|
||||
self.central_widget = QWidget()
|
||||
self.setCentralWidget(self.central_widget)
|
||||
|
||||
@@ -244,6 +246,10 @@ class MainWindow(QMainWindow):
|
||||
self.paste_button.clicked.connect(self.on_paste_button_clicked)
|
||||
buttons_row_layout.addWidget(self.paste_button)
|
||||
|
||||
self.random_button = QPushButton("Случайная", self)
|
||||
self.random_button.clicked.connect(self.on_random_button_clicked)
|
||||
buttons_row_layout.addWidget(self.random_button)
|
||||
|
||||
buttons_row.setLayout(buttons_row_layout)
|
||||
layout.addWidget(buttons_row)
|
||||
|
||||
@@ -268,6 +274,13 @@ class MainWindow(QMainWindow):
|
||||
|
||||
self.central_widget.setLayout(layout)
|
||||
|
||||
def on_random_button_clicked(self):
|
||||
n = int(self.n_input.get_value())
|
||||
self.matrix_a = np.round(np.random.rand(n, n) * 10, 2)
|
||||
self.matrix_b = np.round(np.random.rand(n, 1) * 10, 2)
|
||||
|
||||
self.set_matrix(self.matrix_a, self.matrix_b)
|
||||
|
||||
def on_find_solution_clicked(self):
|
||||
x = solution.iterative_method(self.matrix_a, self.matrix_b)
|
||||
|
||||
@@ -368,9 +381,12 @@ class MainWindow(QMainWindow):
|
||||
|
||||
try:
|
||||
self.det_display.set_text(f"{algorithm.det(self.matrix_a):.5f}")
|
||||
self.cond_display.set_text(f"{algorithm.cond(self.matrix_a):.5f}")
|
||||
except:
|
||||
self.det_display.set_text("Невозможно вычислить")
|
||||
|
||||
try:
|
||||
self.cond_display.set_text(f"{algorithm.cond(self.matrix_a):.5f}")
|
||||
except:
|
||||
self.cond_display.set_text("Невозможно вычислить")
|
||||
|
||||
def set_matrix(self, A: np.matrix, B: np.matrix):
|
||||
|
||||
Reference in New Issue
Block a user