def solveEquation(self): if len(self.file) == 0: return None try: inReader = InputReader(self.file) inReader.readEquationsFromFile() inVal = InputValidator( inReader.equations ) inVal.convertDataToFloat() self.solver = Solver(inVal) self.solver.solveEq() print('Rozwiazanie ukladu rownan:\n') print( self.solver.solution ) except FileNotFoundError: print("This file does'n exist") except ValueError: print("Incorrect insert data (value)")
#DETerminant detMain = data[0][0]*data[1][1] - data[0][1]*data[1][0] detX = data[0][2]*data[1][1] - data[1][2]*data[0][1] detY = data[1][2]*data[0][0] - data[0][2]*data[1][0] if detMain == detX and detX == detY: self.solution = "Uklad oznaczony" if detMain == 0 and detX != detY: self.solution = "Uklad nieoznaczony" self.solution = [detX/detMain, detY/detMain] if __name__=='__main__': print('\n*****************') print('solver - selftest') inReader = InputReader('data.dat') inReader.readEquationsFromFile() inVal = InputValidator( inReader.equations ) inVal.convertDataToFloat() solver = Solver(inVal) solver.solveEq() print('Rozwiazanie rownania:\n') print( solver.solution )