2
$\begingroup$

I'm trying to solve a problem that can be seen in the paper "The Role of the Structural Transformation in Aggregate Productivity". The problem is: enter image description here

Manually it is difficult to find the solution, but this problem has an analytical solution, and the solution is Real. So I'm using Wolfram Mathematica and I make the following code:

ClearAll["Global`*"]

(*Define the utility function*)
Utility = 
  a*Log[ca - abar] + (1 - a)*(1/rho)*
    Log[b*cm^rho + (1 - b)*(cs + sbar)^rho];
(*Define constraint*)

constraint = pa*ca + pm*cm + ps*cs - w *l;
(*Define the Lagrangian and its derivatives*)
Lagrangian = Utility - \[Lambda]*constraint;

Foc1 = D[Lagrangian, ca];
Foc2 = D[Lagrangian, cm];
Foc3 = D[Lagrangian, cs];
Foc4 = D[Lagrangian, \[Lambda]];

sols = Simplify[
  Solve[{Foc1 == 0, Foc2 == 0, Foc3 == 0, Foc4 == 0}, {ca, cm, 
    cs, \[Lambda]},
   Assumptions -> {pa > 0, pm > 0, ps > 0,
      ca > 0, cm > 0, cs > 0,
      abar > 0, sbar > 0,
      w > 0, l > 0,
      0 < a < 1 , 0 < b < 1, rho < -1}
   ]]

However, he does not find a symbolic solution to my problem, the code crashes. So, I tried other ways, and write my problem without Lagrange. But it returns this in a few seconds with no warnings, no helpful messages and no solution.

ClearAll["Global`*"]

(*Definir a função de utilidade*)
Utility = 
  a*Log[ca - abar] + (1 - a)*(1/rho)*
    Log[b*cm^rho + (1 - b)*(cs + sbar)^rho];

(*Definir a restrição*)
constraint = pa*ca + pm*cm + ps*cs - w*l;

(*Definir o objetivo de maximização*)
Objective = -Utility;

(*Resolver o problema de maximização*)
Maximize[{Objective, 
  constraint > 0 && ca > 0 && cm > 0 && cs > 0 && \[Lambda] > 0 && 
   0 < a < 1 && 0 < b < 1 && rho < -1, ca > abar}, {ca, cm, cs}]

The solution is real, but raising expressions to negative Real powers can causes problems? Is there something wrong in my code? What can I do to simplify or force Wolfram to find the solution?

$\endgroup$
5
  • $\begingroup$ Give us a link for the paper where is analytical solution?Thanks $\endgroup$ Feb 15 at 21:53
  • $\begingroup$ For first code and for: rho = -2 can be computed. Try: rho = -2; eq = ({Foc1 == 0, Foc2 == 0, Foc3 == 0, Foc4 == 0} // FullSimplify); Solve[eq, {ca, cm, cs, \[Lambda]}] . $\endgroup$ Feb 15 at 21:56
  • $\begingroup$ The paper can be view here. In appendix A3 the autors provide an analytical solution to this problem. $\endgroup$
    – mjr
    Feb 15 at 22:05
  • $\begingroup$ The author also wrote that these are systems of nonlinear equations, and such systems cannot be solved analytically, only numerically. $\endgroup$ Feb 15 at 22:47
  • $\begingroup$ But in appendix the authors provide an analytical solution to this problem. Equations A-3, A-4 and A-5. In the paper "The Role of the Structural Transformation in Aggregate Productivity", in fact, they don't provide analytical solution, only some of FOCs. $\endgroup$
    – mjr
    Feb 15 at 22:55

1 Answer 1

3
$\begingroup$

Hint.

For $f(x) > 0$

$$ \arg\max \log(f(x)) = \arg\max f(x) $$

so try instead

ClearAll["Global`*"]

(*Define the utility function*)
Utility = a*(ca - abar)^a (b*cm^rho + (1 - b)*(cs + sbar)^rho)^((1 - a)*(1/rho));
(*Define constraint*)

constraint = pa*ca + pm*cm + ps*cs - w*l;
(*Define the Lagrangian and its derivatives*)
Lagrangian = Utility - \[Lambda]*constraint;

Foc1 = D[Lagrangian, ca];
Foc2 = D[Lagrangian, cm];
Foc3 = D[Lagrangian, cs];
Foc4 = D[Lagrangian, \[Lambda]];

sols = Simplify[Solve[{Foc1 == 0, Foc2 == 0, Foc3 == 0, Foc4 == 0}, {ca, cm, cs, \[Lambda]}]]
$\endgroup$
3
  • $\begingroup$ The problem is that he doesn't find a solution to all the unknowns. $\endgroup$
    – mjr
    Feb 15 at 20:09
  • $\begingroup$ Substituting the found values for ca and cm into the constraint, we can conclude that one of ca, cm, cs, depends of the others. $\endgroup$
    – Cesareo
    Feb 15 at 20:55
  • $\begingroup$ This doesn't work well. He cannot find a feasible value for cs. The closest solution I found was the provide by @MariuszIwaniuk where rho equal to -2, but I replace by 2. rho = 2; eq = ({Foc1 == 0, Foc2 == 0, Foc3 == 0, Foc4 == 0} // FullSimplify); Solve[eq, {ca, cm, cs, \[Lambda]}]. $\endgroup$
    – mjr
    Feb 17 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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