【发布时间】:2014-07-31 03:12:33
【问题描述】:
我的整个程序都是正确的(我已经在各个阶段进行了检查)。但是,此模块中突出显示的行返回错误:
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
【问题讨论】:
-
您能提供完整的错误回溯吗?
T是什么?
标签: python function typeerror newtons-method