I want to solve a system of 7 non-linear ecs in two loops (I go through time and space) and it gives me problems in the introduction of the data, sometimes in the function and sometimes in the fsolve. I put the data so that it did the unpacking but it gave problems. It seems that normal works. Every time I modify something slightly it gives me a different problem. Now he is giving me this problem: fsolve: there is a mismatch between the input and output shape of the 'func' argument 'equations'.Shape should be (7,) but it is (7, 20, 30).
def equations(data):
#D,A,S,r,m_f,m_T,rhoV = arg
Di,ri,x,a,m,rho_f,m_ox = data
return (D-(Di+2*ri),
A-np.pi*(D/2)**2,
S-np.pi*D*x,
r-((a/(x**m))*rhoV**n),
m_f-(r*S*rho_f),
m_T-(m_f+m_ox),
m_f-(m_T/A))
sol0=np.array([0.01,0.001,0.001,0.001,0.01,0.01,0.1])
for t in range(1,20):
for i in range(0,L):
#arg=[D[t,i],A[t,i],S[t,i],r[t,i],m_f[t,i],m_T[t,i],rhoV[t,i]]
data=[D[t-1,i],r[t-1,i],x[i],a,m,rho_f,m_ox]
sol[t,i,0:7]=optimize.fsolve(equations,sol0)#,args=data)
OF[t,i]=m_ox[t,i]/sol[t,i,4]
sol[t,i,8]=OF[t,i]