相关疑难解决方法(0)

'语法错误:语法无效'没有明显原因

我一直试图修复,无法找到错误不断出现的原因.Pmin,Pmax,w,fi1和fi2都被赋予了有限值

guess=Pmin+(Pmax-Pmin)*((1-w**2)*fi1+(w**2)*fi2)
Run Code Online (Sandbox Code Playgroud)

当我从代码中删除此行时,在下一行代码中出现相同的错误,再次无缘无故我能想到

编辑:这是我所指的代码块:

def Psat(self, T):
    pop= self.getPborder(T)
    boolean=int(pop[0])

    P1=pop[1]
    P2=pop[2]
    if boolean:
        Pmin = float(min([P1, P2]))
        Pmax = float(max([P1, P2]))
        Tr=T/self.typeMolecule.Tc
        w=0.5*(1+scipy.tanh((10**5)*(Tr-0.6)))
        fi1=0.5*(1-scipy.tanh(8*((Tr**0.4)-1)))
        fi2=0.460*scipy.sqrt(1-(Tr-0.566)**2/(0.434**2)+0.494

        guess = Pmin+(Pmax-Pmin)*((1-w**2)*fi1+(w**2)*fi2)   #error here

        solution = scipy.optimize.newton(funcPsat,guess, args=(T,self))
Run Code Online (Sandbox Code Playgroud)

python syntax-error spyder

25
推荐指数
2
解决办法
29万
查看次数

标签 统计

python ×1

spyder ×1

syntax-error ×1