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?

  • 6
    $\begingroup$ 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. $\endgroup$
    – Szabolcs
    Commented Jun 6, 2012 at 12:40
  • $\begingroup$ 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. $\endgroup$ Commented Jun 6, 2012 at 13:35
  • 1
    $\begingroup$ 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. $\endgroup$
    – celtschk
    Commented Jun 6, 2012 at 19:10
  • $\begingroup$ 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}]}. $\endgroup$
    – Matariki
    Commented Jun 7, 2012 at 1:07
  • 9
    $\begingroup$ Anyway, it looks like that optimization with parameters works rather poorly in Mathematica. $\endgroup$
    – Oleg
    Commented Jun 7, 2012 at 19:07

2 Answers 2


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.

  • $\begingroup$ Interestingly that precise input will not evaluate in Mathematica 10.0.1 or am I missing something here? $\endgroup$
    – gwr
    Commented Nov 30, 2014 at 15:06
  • $\begingroup$ @gwr You are right, thank you. I have rewritten my answer. $\endgroup$
    – Dr_Zaszuś
    Commented Dec 3, 2014 at 16:39
  • $\begingroup$ 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. $\endgroup$
    – gwr
    Commented Dec 3, 2014 at 18:45
  • $\begingroup$ @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... $\endgroup$
    – Dr_Zaszuś
    Commented Dec 5, 2014 at 15:36
  • $\begingroup$ 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... $\endgroup$
    – gwr
    Commented Dec 8, 2014 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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