# Parametric Optimization In Mathematica

I want to solve the following problem:

$$\max_q \dfrac{q}{a}\left[ (-\log(1-q))^{-a} - (-\log(q))^{-a} \right]$$ subject to $$1\geq q \geq 0$$ for each $$a\neq 0$$.

Here is the code I used:

Maximize[{(q ((-Log[1 - q])^-a - (-Log[q])^-a))/a, 1 >= q >= 0 && a != 0}, q]



Mathematica throws the problem back at me.

At first, I thought this was due to the parametric nature of the problem but then I tried to maximize $$-(x-a)^2$$ and it seems Mathematica can handle it.

Then, I thought maybe I should say it needs to be solved for each $$a\neq 0$$ so I tried

Maximize[{(q ((-Log[1 - q])^-a - (-Log[q])^-a))/a, 1 >= q >= 0 && ForAll[a, a != 0]}, q]


but this didn't work either.

I read that ParametricConvexOptimization in Mathematica but I want to be able to solve problems. Still, I tried to run it (without checking if my objective is concave) and as you can guess, it didn't work either. Here is my attempt at that:

OptQuant = ParametricConvexOptimization[-((q ((-Log[1 - q])^-a - (-Log[q])^-a))/a), {1 >= q >= 0, a != 0}, q, a]


Does anyone have any suggestion about what else I can try to solve this and other related problems?

• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Sep 29 at 20:15
• You have two typos: (1) $1\geq 1\geq 0 (which is inconsequential) and (2) && 1 >= q >= 0 &&  should be , 1 >= q >= 0 && . Although fixing those two does not get you a useful answer. – JimB Sep 29 at 20:24 • Thank you! I fixed these. Sep 29 at 20:29 • It appears that there is no maximum when$a>1$. – JimB Sep 29 at 20:30 ## 1 Answer One approach is to find the zero of Reduce[D[q ((-Log[1 - q])^-a - (-Log[q])^-a)/a, q] == 0 && 0 < q < 1, q, Reals]  but it returns unevaluated, suggesting that there is no symbolic solution. In the absence of a symbolic solution, a numeric solution can be obtained quickly with, Plot[NMaxValue[{(q ((-Log[1 - q])^-a - (-Log[q])^-a))/a, 0 < q < 1}, q], {a, -1, 1}, AxesLabel -> {a, max}, ImageSize -> Large, LabelStyle -> {15, Bold, Black}, MaxRecursion -> 3] • Thanks a lot! I actually played around with NMaximize as well but didn't get anything. Would it be possible to get the argmax by this method? I am more interested in knowing the optimal$q$given$a\$ than the maximum level of the objective function. Sep 29 at 20:52
• @economicagent Use NArgMax instead. of NMaxValue`. Sep 29 at 20:56