def makeEquation(): self.matrix=[[0 for column in range(self.reactantsNumber+self.resultantsNumber)] for row in range(len(self.element))] for elem in self.element: for reac in self.reactants: zkh=reac.find("(") ykh=reac.find(")") index=reac.find(elem) if index==-1: self.matrix[self.element.index(elem)][self.reactants.index(reac)]=0 else: if zkh==-1: #without () self.matrix[self.element.index(elem)][self.reactants.index(reac)]=func.countNumber(elem,reac) else: #with () content=func.getContent(reac) co=0 for keys in content.keys(): if keys.find(elem)!=-1: co=co+func.countNumber(elem, keys)*content[keys] self.matrix[self.element.index(elem)][self.reactants.index(reac)]=co for resul in self.resultants: zkh=resul.find("(") ykh=resul.find(")") index=resul.find(elem) if index==-1: self.matrix[self.element.index(elem)][self.resultants.index(resul)+self.reactantsNumber]=0 else: if zkh==-1: #without () self.matrix[self.element.index(elem)][self.resultants.index(resul)+self.reactantsNumber]=-func.countNumber(elem,resul) else: #with () content=func.getContent(resul) co=0 for keys in content.keys(): if keys.find(elem)!=-1: co=co+func.countNumber(elem, keys)*content[keys] self.matrix[self.element.index(elem)][self.resultants.index(resul)+self.reactantsNumber]=-co
def getTheAnswer(): self.solution=func.getSolution(self.element, self.matrix)