0
我的整個程序是正確的(我已經在各個階段檢查過)。在此模塊中突出顯示的行,然而,返回錯誤:scipy.optimize.newton給出TypeError:只能連接元組(不是「int」)到元組
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'? – jonrsharpe