2
$\begingroup$

I study economics and I have the ambition to numerically solve a nonlinear system of 8 equations. My goal is to see how some equilibrium objects resulting from the solutions of this system change with the value of some parameters. I am trying with Manipulate[NSolve[...]], but the answer of Mathematica is "aborted". Any guesses? Is it better to use FindRoot? Did I write the equations in the wrong way? Or is my problem simply too complex? Below my code, thanks

Manipulate[NSolve[{Nl == (wl1/(
   A1g*λ*η*(1 - ϕm1 - ϕh1)^λ))^(1/(λ*η - 1))*(1 + (wh1/wl1)^(η/(η - 1))*((
      1 - ϕm1 - ϕh1)/(ah*ϕh1)))^((
   1 - λ)/(λ*η - 1)) + (wl2/(
   A2g*λ*η*(1 - ϕm2 - ϕh2)^λ))^(1/(λ*η - 
    1))*(1 + (wh2/wl2)^(η/(η - 1))*((
      1 - ϕm2 - ϕh2)/(ah*ϕh2)))^((
   1 - λ)/(λ*η - 1)), Nm == (wm1/(A1g*η*ϕm1*am))^(1/(η - 1)) + (wm2/(
  A2g*η*ϕm2*am))^(1/(η - 1)), Nh == (wl1/(
   A1g*λ*η*(1 - ϕm1 - ϕh1)^λ))^(1/(λ*η - 
    1))*(1 + (wh1/wl1)^(η/(η - 1))*((
      1 - ϕm1 - ϕh1)/(ah*ϕh1)))^((
   1 - λ)/(λ*η - 1))*(wh1/wl1)^(
  1/(η - 1))*((1 - ϕm1 - ϕh1)/(
   ah*ϕh1))^(1/(η - 1)) + (wl2/(
   A2g*λ*η*(1 - ϕm2 - ϕh2)^λ))^(1/(λ*η - 
    1))*(1 + (wh2/wl2)^(η/(η - 1))*((
      1 - ϕm2 - ϕh2)/(ah*ϕh2)))^((
   1 - λ)/(λ*η - 1))*(wh2/wl2)^(
  1/(η - 1))*((1 - ϕm2 - ϕh2)/(
   ah*ϕh2))^(1/(η - 1)), (wl1/wl2) == (pH1/
 pH2)^α, (wm1/wm2) == (pH1/pH2)^α, (wh1/
 wh2) == (pH1/
 pH2)^α, (wl1/(
   A1g*λ*η*(1 - ϕm1 - ϕh1)^λ))^(1/(λ*η - 
    1))*(1 + (wh1/wl1)^(η/(η - 1))*((
      1 - ϕm1 - ϕh1)/(ah*ϕh1)))^((
   1 - λ)/(λ*η - 1))*
  wl1 + (wm1/(A1g*η*ϕm1*am))^(1/(η - 1))*
  wm1 + (wl1/(
   A1g*λ*η*(1 - ϕm1 - ϕh1)^λ))^(1/(λ*η - 
    1))*(1 + (wh1/wl1)^(η/(η - 1))*((
      1 - ϕm1 - ϕh1)/(ah*ϕh1)))^((
   1 - λ)/(λ*η - 1))*(wh1/wl1)^(
  1/(η - 1))*((1 - ϕm1 - ϕh1)/(
   ah*ϕh1))^(1/(η - 1))*wh1 == (
pH1*H)/α, (wl2/(
   A2g*λ*η*(1 - ϕm2 - ϕh2)^λ))^(1/(λ*η - 
    1))*(1 + (wh2/wl2)^(η/(η - 1))*((
      1 - ϕm2 - ϕh2)/(ah*ϕh2)))^((
   1 - λ)/(λ*η - 1))*
  wl2 + (wm2/(A2g*η*ϕm2*am))^(1/(η - 1))*
  wm2 + (wl2/(
   A2g*λ*η*(1 - ϕm2 - ϕh2)^λ))^(1/(λ*η - 
    1))*(1 + (wh2/wl2)^(η/(η - 1))*((
      1 - ϕm2 - ϕh2)/(ah*ϕh2)))^((
   1 - λ)/(λ*η - 1))*(wh2/wl2)^(
  1/(η - 1))*((1 - ϕm2 - ϕh2)/(
   ah*ϕh2))^(1/(η - 1))*wh2 == (pH2*H)/α}, {wh1, wh2, wm1, wm2, wl1, wl2, pH1, pH2}, Reals], {α, 0.001, 0.999}, {λ, 1, 1.2}, {η, 0.6, 0.8}, {ϕm1, 0.001, 0.999}, {ϕh1, 1 - ϕm1, 0.999}, {ϕm2, 0.001, 0.999}, {ϕh2, 0.001, 0.999}, {ah, 1, 2}, {am, 1, 2}, {A1g, 1, 2}, {A2g, 1, 2}, {Nh, 1, 2}, {Nm, 1, 2}, {Nl, 1, 2}, {H, 1, 2}]
$\endgroup$
2
  • $\begingroup$ Welcome! To make the most of Mma.SE start by taking the tour now. It will help us to help you if you write an excellent question. Edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$
    – rhermans
    Jun 1, 2018 at 15:13
  • 4
    $\begingroup$ Fortunately the answer to your question was not related at all to the details of your equation. In the future, you shouldn't have expectation of anybody volunteering their time to look for mistakes in such a wall of code. Always use a minimal working example of working code and data to show specifically what you are working with in a way that makes it easy for anybody to replicate your problem. $\endgroup$
    – rhermans
    Jun 1, 2018 at 15:19

1 Answer 1

6
$\begingroup$

You get $Aborted because Manipulate is constrained by DynamicEvaluationTimeout and your calculation is taking longer than the timeout value.

For example

Style[
 Manipulate[
  Pause[3];
  1 + 2
  , {z, 0, 1}
  ]
 , DynamicEvaluationTimeout -> 1
 ]

Mathematica graphics

You would have found out by yourself if you had searched for $Aborted and Manipulate in this site.

$\endgroup$
2
  • $\begingroup$ Thanks. I've added the suggested option but either I still get $Aborted or, if I set an higher value, it crashes. I've also tried to restrict manipulation range to only one values for the parameters but still doesn't work. I am wondering whether I am using the right command to solve my problem, thanks $\endgroup$ Jun 2, 2018 at 17:05
  • 1
    $\begingroup$ @FabioCerina lookup SynchronousEvaluation, ControlActive and related functions. $\endgroup$
    – Kuba
    Jun 4, 2018 at 19:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.