我的整个程序是正确的(我已经在各个阶段进行了检查)。但是,此模块中突出显示的行返回错误:
TypeError: can only concatenate tuple (not "int") to tuple
我不知道为什么会这样。funcPsat
返回浮点值。我将不胜感激任何有用的建议!
import scipy.optimize.newton as newton
def Psat(self, T):
pop= self.getPborder(T)
boolean=int(pop[0])
P1=pop[1]
P2=pop[2]
if boolean:
Pmin = min([P1, P2])
Pmax = max([P1, P2])
if Pmin > 0.0:
Pguess = 0.5*(Pmin+Pmax)
else:
Pguess=0.5*Pmax
solution = newton(self.funcPsat, Pguess, args=(T)) #error in this line
return solution
else:
return None