python - Non-linear system of equations Julia -


i'm trying solve large number (50) of non-linear simultaneous equations in julia. moment i'm trying make work 2 equations syntax right etc. however, i've tried variety of packages/tools - nlsolve, nsolve in sympy , nlopt in jump (where ignore objective function , enter equality constraints)- without luck. guess should focus on making work in one. i'd appreciate advice on choice of packages , if possible code.

here's how tried in nlsolve (using in mcpsolve mode can impose constraints on variables solving - x[1] , x[2] - unemployment rates , bounded between 0 , 1) :

using distributions using devectorize using distances using statsbase using numericextensions using nlsolve  beta = 0.95                                                                 xmin= 0.73                                                                  xmax = xmin+1                                                              sigma = 0.023                                                             eta = 0.3                                         delta = 0.01                                                                                                 gamma=0.5                                                                    kappa = 1                                                                   psi=0.5 ns=50 prod=linspace(xmin,xmax,ns) l1=0.7 l2=0.3                                             wbar=1 r=((1/beta)-1-1e-6 +delta)   ## test code  function f!(x, fvec)      ps1= wbar + (kappa*(1-beta*(1-sigma*((1-x[1])/x[1]))))     ps2= wbar + (kappa*(1-beta*(1-sigma*((1-x[2])/x[2]))))      prod1=prod[1]     prod2=prod[50]     y1=(1-x[1])*l1     y2=(1-x[2])*l2     m=(((prod1*y1)^((psi-1)/psi))+((prod2*y2)^((psi-1)/psi)))     k=((r/eta)^(1/(eta-1)))*m      pd1=(1-eta)*(k^eta)*(m^(-eta))*prod1     pd2=(1-eta)*(k^eta)*(m^(-eta))*prod2      fvec[1]=pd1-ps1     fvec[2]=pd2-ps2 end  mcpsolve(f!,[0.0,0.0],[1.0,1.0], [ 0.3, 0.3]) 

i error message:

error message

any suggestions welcome! appreciate formulas pretty ugly let me know if further simplifications helpful (i have tried!).

i've thought giving initial conditions outside range of bounds, tried mcpsolve(f!,[0.0,0.0],[0.0,0.0],[0.3, 0.3]) , worked.

however, i've tried other combinations:

mcpsolve(f!,[0.4,0.4], [0.0,0.0], [0.3, 0.3]) did worked

mcpsolve(f!,[0.4,0.4], [0.3,0.3], [1.0,1.0]) did not

mcpsolve(f!,[0.6,0.6], [1.0,1.0], [0.3,0.3]) did not

have checked these values on test?


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -