0

我正在解决大约 37 个非线性方程和 37 个变量的问题。参数被收集,J=dict()我试图解决这个问题,fsolve但它只返回我给出的初始值。

这是我的代码:

def NodalFlowBalance(p):
   FlowAbsFlow = (J['g_Yl'] / J['g_k']).dot(p ** 2)[:, None]
   Flow = np.sign(FlowAbsFlow) * np.sqrt(np.abs(FlowAbsFlow))
   NodalFlowBalance = (J['g_Y'].dot(Flow))[:, 0] + J['Source1'] -J['Demand']
   NodalFlowBalance = np.delete(NodalFlowBalance, J['SlVar'])
   NodalFlowBalance = np.hstack([NodalFlowBalance, p[J['SlVar']] - J['SlPressure']])
   return NodalFlowBalance 

p = fsolve(NodalFlowBalance, p0)

其中J['g_Yl']J['g_Y']是矩阵,J['g_k']是向量。我也试了J进去args=(J,),还是不行。还有其他选择吗?

4

0 回答 0