2
$\begingroup$

I would like to solve constrained maximization problem by the Lagrangian.

$ max_{q(\omega)}\ U=\left(\int_{0}^{n} q(\omega)^{\rho} d \omega\right)^{\frac{1}{\rho}} \quad 0<\rho<1 $

$s.t.\ \int_{0}^{n} p(\omega) q(\omega) d \omega = w$

Setting the Lagrangian function, $\mathcal{L}=U^{\rho}-\lambda\left(\int_{0}^{n} p(\omega) q(\omega) d \omega-\mathrm{w}\right)$

Take the first derivatives, $\frac{\partial \mathcal{L}}{\partial q(\omega)}=\rho q(\omega)^{\rho-1}-\lambda p(\omega)=0$

Rearranging terms yields, $q(\omega)=\left(\frac{\lambda p(\omega)}{\rho}\right)^{\frac{1}{\rho-1}}$

I try the following code

U[i_] := Integrate[q[i]^rho, {i, 0, n}]^(1/rho) L[n_, q_, p_] := U[n]^rho - lambda*(Integrate[q[i]*p[i], {i, 0, n} Solve[D[L[n, q, p], p]==0,q] 

that is not working.

$\endgroup$
3
  • 1
    $\begingroup$ Exponent is p not $\rho$. What is utility? $\endgroup$ Commented Jun 18, 2020 at 4:17
  • 1
    $\begingroup$ A typo. It is U. @OkkesDulgerci $\endgroup$ Commented Jun 18, 2020 at 4:31
  • $\begingroup$ Derivative should be respect to q not p $\endgroup$ Commented Jun 18, 2020 at 4:43

1 Answer 1

4
$\begingroup$
U := Integrate[q^ρ, {w, 0, n}]^(1/ρ) L[w_, q_, p_] := PowerExpand[U^ρ] - λ (Integrate[p q, {w, 0, n}] - w); Solve[D[L[w, q, p], q] == 0, q] // Quiet 

$\left\{q\to \left(\frac{\lambda p}{\rho }\right)^{\frac{1}{\rho -1}}\right\}$

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.