I have a system of four nonlinear equations. Some of the exponents are fractions. I was wondering if this is what is causing NSolve to run for hours without giving any results.

I first create a list of parameters that I eventually want to play around with to see how results change. This parameter list is "dat". I then specify the equations as follows:

dat = {alpha -> 1/3, beta -> 1/3, sigma -> 1/3, gam -> 0.5, 
  psy -> 0.5, delta -> 0.5, vu -> 0.5, a -> 1, A -> 1/3, B -> 1/3, 
  C -> 1/3, Ls -> 10, T -> 10, mc -> 1.5}

{p2 - w^psy pw^gam ((psy/gam)^gam + (gam/psy)^psy) == 0, 
  Ls - (beta/w)^(alpha + sigma) (pw/(alpha (1 + a C r T)))^
      alpha (r/sigma)^sigma (w Ls delta + r T A) - (pw psy/w gam)^
      gam ((w Ls vu + r T B)/p2) == 0, 
  T - (sigma/r)^(alpha + beta) (w/beta)^
      beta (pw/(alpha (1 + a C r T)))^alpha (w Ls delta + r T A) == 0, 
  pw - (((((1 + a C r T) alpha)/pw)^(beta + sigma) (w/beta)^
           beta (r/sigma)^
           sigma (w Ls delta + r T A) +  ((w gam)/(psy pw))^
           psy ((w Ls vu + r T B)/p2)) mc (1 + 
         a C r T))/((((1 + a C r T) alpha)/pw)^(beta + sigma) (w/
           beta)^beta (r/sigma)^
         sigma (w Ls delta + r T A)  + ((w gam)/(psy pw))^
         psy ((w Ls vu + r T B)/p2) (1 + a C r T)) == 0} /. dat

And then proceed with NSolve:

NSolve[%, {w, r, p2, pw}, Reals]

But Nothing happens. I tried using Rationalize but it does not seem to help. I am new to Mathematica so I hope that I am doing something wrong and that I missed something and can solve the system. Any suggestions?

Finally, how can I loop and redo this calculation with different parameters in the "dat" list?

  • $\begingroup$ (1) It seems that the complexity is beyond what NSolve can handle, at least in reasonable time. I converted decimals to rationals and set exprs equal to that system. From there, to see how complicated the underlying polynomial system is, you might do new = Internal`MakePolynomial[exprs]. $\endgroup$ – Daniel Lichtblau Mar 25 '15 at 22:05
  • $\begingroup$ (2) You might try for isolated solutions using FindRoot (instead of NSolve) with some set of starting values. Varying that set could lead to different solutions. $\endgroup$ – Daniel Lichtblau Mar 25 '15 at 22:06
  • $\begingroup$ Where can I find documentation on Internal MakePolynomial? I have never seen this command before? $\endgroup$ – Goose Mar 25 '15 at 22:29
  • 1
    $\begingroup$ (You can't. Note the "Internal".) What it shows, though, is the construction of polynomials in some new set of variables, such that everything is explicitly polynomial in those variables. They are also shown in the second element of the List result. $\endgroup$ – Daniel Lichtblau Mar 25 '15 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.