本文整理汇总了Python中solver.Solver.solveEq方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.solveEq方法的具体用法?Python Solver.solveEq怎么用?Python Solver.solveEq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solver.Solver
的用法示例。
在下文中一共展示了Solver.solveEq方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ApplicationMgr
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import solveEq [as 别名]
class ApplicationMgr():
'''Klasa bedaca menadzerem aplikacji rozwiazujacej rownanie'''
def __init__(self):
if len( sys.argv) == 2:
self.file = sys.argv[1]
else:
self.file = ""
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)")
# except Exception:
# print("Incorrect insert data")
def changeFile(self):
self.file = input()
def printMenu(self):
print('\n\n\n-----------------------------------')
print('File: '+appMgr.file)
print('Press:')
print(' 1 - Solve equation')
print(' 2 - Change file')
print(' 3 - Draw chart')
print(' 4 - Exit')
def drawChart(self):
functionFile = open('function.dat','w')
plotFile = open('plot.gp', 'w')
functionFile.write(str(self.solver.solution[0])+" "+str(self.solver.solution[1]))
plotFile.write("plot 'function.dat' with lines;")
os.system('gnuplot plot.gp')
os.remove('plot.gp')