I have a moderately large system of non-linear equations that I want to solve using scipy.optimize in Julia. The problem is that I store the equations in a vector before I pass them to the solver and PyCall doesn’t accept that. For example these methods both work:

```
using PyCall
@pyimport scipy.optimize as so
function F(x)
f1=1- x[1] - x[2]
f2=8 - x[1] - 3*x[2]
return f1, f2
end
x0 = [1,1]
x = so.fsolve(F, x0)
function G(x)
f=[1 - x[1] - x[2],
8 - x[1] - 3*x[2]]
return f
end
x0 = [1,1]
x = so.fsolve(G, x0)
```

However these do not:

```
function H(x)
f[1]=1 - x[1] - x[2]
f[2]=8 - x[1] - 3*x[2]
return f
end
x0 = [1,1]
x = so.fsolve(H, x0)
function P(x)
f[1]= 1 - x[1] - x[2]
f[2]= 8 - x[1] - 3*x[2]
return f[1], f[2]
end
x0 = [1,1]
x = so.fsolve(P, x0)
```

I don’t think it’s feasible to not use a loop because of the nature of the problem. Is there any way to return the vector in a way that fsolve can accept it?

I’m fairly new to Julia and I want to translate some MATLAB files in order to get a sense of the language. I have tried the NLsolver, but the system doesn’t converge even though I give the solution that I obtained from MATLAB as an initial guess.