# Optimization with assumptions

I have the following problem, when I am trying to optimize function with pre-defined assumptions.

I am using Mathematica 8 and I wrote the following simple code

$Assumptions = (m > 0) Minimize[{x^m, x >= 1}, x]  It is clear, that the answer is 1, since$x^m\ge 1$if$x\ge 1$for all positive$m$. However, Mathematica fails to calculate this simple problem. What do I do wrong? Should I use another function for minimization? - The values of $Assumtpions will only be used by functions which themselves have an Assumptions option. I know this doesn't solve your problem, but at least it clarifies why this doesn't work. It seems sometimes it's possible to include assumptions on the parameters in the constraint list, but in this case it doesn't work. –  Szabolcs Jun 6 '12 at 12:40
Try mminimize x^m when x >= 1 and m>=0 and minimize x^m when x >= 1 and m<0 in Wolfram Alpha! The first question is bestowed with a better fitting answer than the second one. As for $0>m>-\infty$ the function $x^m$ has no global minimum the second answer suffers from numerical defects. –  PlatoManiac Jun 6 '12 at 13:35
Mathematica also fails for me with Minimize[{x^m,x>=1&&m>0},x] (additional condition explicitly given) and Minimize[{x^(Abs[m]+1/10),x>=1},x] (the exponent being obviously positive). Minimize[{x^2,x>=1},x] works fine, however. –  celtschk Jun 6 '12 at 19:10
It seems the symbolic engine cannot minimize functions with the power of two unknowns. You could try a numerical approach {NMinimize[{x^m, x >= 1 && m > 0.01}, {x, m}]}. –  Matariki Jun 7 '12 at 1:07
Anyway, it looks like that optimization with parameters works rather poorly in Mathematica. –  Oleg Jun 7 '12 at 19:07

## 2 Answers

Try This,

NMinimize[{X^m, X >= 1, m > 0, m \[Element] Integers}, {X, m}]


This will give you what you like

{1., {X -> 1., m -> 2}}

-

Minimization (especially in several dimensions) is in general a tough task, and it is usually better to facilitate the task for Mathematica. So normally in calculations in Mathematica it is easier to replace the minimization procedure by an equivalent one, i.e. to take the derivative. The following example

function[x_, m_] := x^m;
derivative = D[function[x, m], x];
Solve[derivative == 0, x]


gives the desired analytical result

{{x -> 0^(1/(-1 + m))}}


for any parameter m. It tells you that the only extremum point point of the function is 0 (for m<>1). This means that if you take the interval x>=1 for minimization, your function does not have extremum points inside it and hence attains its minimum at the boundary.

You can also directly write

Solve[{derivative == 0,x>1,m>0}, x]


to see that no extremum points exist inside the defined interval.

To conclude, you can analytically minimize complicated expressions in Mathematica, but you should wisely choose the way you formulate the problem for the computer.

Thanks to gwr for pointing out that my previous answer didn't work.

-
Interestingly that precise input will not evaluate in Mathematica 10.0.1 or am I missing something here? –  gwr Nov 30 at 15:06
@gwr You are right, thank you. I have rewritten my answer. –  Szczypawka Dec 3 at 16:39
I still wonder why it seems to have worked in previous editions and stays unevaluated in Version 10.0.1 - since I pay for Premium Service, let's wait to hear what WRI has to say. –  gwr Dec 3 at 18:45
@gwr Well, the reason why I changed the answer was also that it didn't work in my Mathematica 9.0. Although I perfectly remember it working when I wrote the original answer. Anyway, I am not sure it is an easy task to give an analytical minimization result for the case of several variables dependency, so it would not surprise me much to see it unevaluated... –  Szczypawka Dec 5 at 15:36
Granted that the problem in itself is hard to do but returning a syntactically correct expression in an unevaluated form seems a bit unfortunate for a heavy-weight tool like Mathematica. There should at least be a message, shouldn't there? -- I have btw not heard from WRI yet; funny how three days response time are counted... –  gwr Dec 8 at 10:49