An Interval should be a one-dimensional region, so a region. I tried to minimize a function over an interval, e.g.:

f[x_] := x^5 + 3 x^4 - 2 x^3 + x - 1;
ymin = NMinimize[f[x], x ∈ Interval[{0, π}]]

I get an error message. I do not see why. The variable x is not declared to be numeric (see NIntegrate and Interval regions)

  • 1
    $\begingroup$ I don't see why, either. It looks like a bug in NMinimize to me. $\endgroup$
    – m_goldberg
    Commented Feb 7, 2015 at 14:07

2 Answers 2


This is a syntax issue. Use

ymin = NMinimize[f[x], {x} ∈ Interval[{0, π}]]


(* {-1., {x -> 0.}} *)


Using ImplicitRegion has the same issue. {x} must be used instead of x

ymin = NMinimize[f[x], {x} ∈ ImplicitRegion[0 <= x <= π, {x}]]
  • $\begingroup$ What MathematicaVersion do you use (I have I get the error even when I copy and paste your answer.... $\endgroup$
    – mgamer
    Commented Feb 7, 2015 at 14:20
  • $\begingroup$ I copied the wrong line from my notebook. The correct expression appears now. Thanks for identifying my mistake. For completeness, I too have V10.0.2.0. $\endgroup$
    – bbgodfrey
    Commented Feb 7, 2015 at 14:28
  • 1
    $\begingroup$ I think this is a very interesting finding on your part, but I still think the OP's version ought to work. I have submitted a problem report to WRI tech support arguing the issue. $\endgroup$
    – m_goldberg
    Commented Feb 7, 2015 at 14:35
  • $\begingroup$ @m_goldberg At a minimum, documentation is ambiguous. For single variables, it shows x\[Element]reg, but for multiple variables {x, y} \[Element] reg. It was this disparity that caused me to try {x}. I think you should report the issue. Thanks. $\endgroup$
    – bbgodfrey
    Commented Feb 7, 2015 at 14:40
  • $\begingroup$ @m_goldberg Thank you for editing my answer (and the question by @mgamer) to replace \[Pi] by π, etc. Where can we find Greek and special characters to paste into questions, answers, and comments? I searched "Help" without success. Thanks. $\endgroup$
    – bbgodfrey
    Commented Feb 7, 2015 at 16:43

Today I got a couple of emails from WRI tech support. The first indicated that they had accepted this issue as a bug.

I have filed a bug report with the development team. Thank you very much for giving us feedback and hopefully this issue would be improved in future release.

The second email retracted the first and reclassified the problem as a documentation issue.

It looks like that this issue is more like a documentation issue. You may use

NMinimize[x, {x} ∈ Interval[{0, 1}]]


NMinimize[Indexed[x, 1], x ∈ Interval[{0, 1}]]

to restrain the variable x to be in the interval from 0 to 1.

I will file a separate suggestion for the documentation issue if I get confirmation from the developers.

The second form, which in the context of the question being considered here, becomes

f[x_] := x^5 + 3 x^4 - 2 x^3 + x - 1
NMinimize[f[Indexed[x, 1]], x ∈ Interval[{0, π}]]
{-1., {x -> {0.}}}

may be taken as second answer. See Examples under Indexed for more information of this usage.


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.