I'm trying to derive the demand function for y1 and y0 respectively. I could calculate by hand but wanted to practice the Mathematica. The problem is that I couldn't solve the λ. This λ is still in the y1 and y0 functions...

enter image description here

I looked up an example from a random website and then applied it in my context.

enter image description here

I don't know where I did wrong (Rather than using Lagrangian, I just tried to cancel out the λ by using foc1 and foc2 function and rearranged in terms of either y1 or y0 and then plugged in foc3 so that I can get the demand function of y1 or y0. But here the problem is that it took forever and couldn't get the result(I tried solve, reduce, simplify functions but the Mathematica kept showing 'running'...) It would be greatly appreciated if you help me out!

  • 5
    $\begingroup$ Please post Mathematica code rather than pictures. $\endgroup$ – b.gates.you.know.what Nov 8 '16 at 8:00

First I have the same comment than b.gatessucks

Here is an inelegant solution and I would be please to find an elegant one, but, obviously, it does the job :

 \[Rho] = 1 - 1/\[Sigma];
 u = \[Theta] Subscript[y, 1]^\[Rho] + (1 - \[Theta]) Subscript[y, 
 bc = w - F - (Subscript[a, 1] Subscript[y, 1] + 
 Subscript[a, 0] Subscript[y, 0]);
 eqL = l ==  u + \[Lambda] bc
 foc1 = D[eqL, Subscript[y, 1]]
 foc2 = D[eqL, Subscript[y, 0]]
 foc3 = D[eqL, \[Lambda]]
 s1 = Solve[foc1, {Subscript[y, 1]}]
 s0 = Solve[foc2, {Subscript[y, 0]}]
 usl = Solve[
  Factor[foc3 //. {s1[[1, 1]], 
  s0[[1, 1]], (-((-1 + \[Theta] + 
      1/\[Sigma] - \[Theta]/\[Sigma])/(\[Lambda] Subscript[a, 
      0])))^\[Sigma] -> (1/\[Lambda])^\[Sigma] (-((-1 + \[Theta] \
   + 1/\[Sigma] - \[Theta]/\[Sigma])/Subscript[a, 
      0]))^\[Sigma] , (-((-\[Theta] + \[Theta]/\[Sigma])/(\
  \[Lambda] Subscript[a, 
      1])))^\[Sigma] -> (1/\[Lambda])^\[Sigma] (-((-\[Theta] + \
  \[Theta]/\[Sigma])/ Subscript[a, 
      1]))^\[Sigma], (1/\[Lambda])^\[Sigma] -> \[Mu]}], \[Mu]] /. \
 \[Mu] -> 1/\[Lambda]
 s1 /. usl
 s2 /. usl

/. is the substitution command (a-> b) the substitution rule //. is the repeted substitution command.

In what concerns transcendantal function like Cobb-Douglas or CES, to my knowledge, there is no automated mechanism in Ma.

  • $\begingroup$ What is s2 in your code? Also, you can use the Steampiano online converter to convert greek symbols to Unicode glyphs; this will significantly improve the readability of your answer. $\endgroup$ – MarcoB Nov 8 '16 at 17:22
  • $\begingroup$ Thank you so much! By the way, what is s1[[1,1]] , the bracket, mean? $\endgroup$ – Jooho Kim Nov 8 '16 at 23:11
  • $\begingroup$ @cyrille.piatecki The original answers for y1 and y0 are '(w - F)/Subscript[a, 1] (1 + ((1 - [Theta])/[Theta])^[Sigma] (Subscript[a, 1]/ Subscript[a, 0])^([Sigma] - 1))' and '(w - F)/Subscript[a, 0] (1 + 1/(((1 - [Theta])/[Theta])^[Sigma] (Subscript[a, 1]/ Subscript[a, 0])^([Sigma] - 1)))' To double check, I plug in arbitrary values for all the parameters but show a bit different results. Could you take a look at your code again? because I manage to understand your codes... $\endgroup$ – Jooho Kim Nov 9 '16 at 2:05
  • $\begingroup$ sorry not to be reactive but unfortunately I have a problem with internet. $\endgroup$ – cyrille.piatecki Nov 9 '16 at 12:04
  • $\begingroup$ Ryan I am sorry I will have a look this evening --- France --- and I will send you the code tomorrow $\endgroup$ – cyrille.piatecki Nov 9 '16 at 15:00

Your Answer

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

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