# Constrained maximization problem

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.

• Exponent is p not $\rho$. What is utility? – OkkesDulgerci Jun 18 '20 at 4:17
• A typo. It is U. @OkkesDulgerci – XJ.C Jun 18 '20 at 4:31
• Derivative should be respect to q not p – OkkesDulgerci Jun 18 '20 at 4:43

U := Integrate[q^ρ, {w, 0, n}]^(1/ρ)

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