0
$\begingroup$

This question already has an answer here:

If you Solve an equation, you obtain all solutions.

But If you NMinimize a function, you only get one minimum.

The question is: is there a way to obtain all minima of a given function?

Example:

Solve[((x - 2) (x + 2))^2 == 0, x]
Print["____________"]
NMinimize[((x - 2) (x + 2))^2, x]
NMinimize[ {((x - 2) (x + 2))^2, x >= 0}, x]

yields

{{x -> -2}, {x -> -2}, {x -> 2}, {x -> 2}}
____________
{0., {x -> -2.}}
{0., {x -> 2.}}

You can see that for Solve you obtain all solutions, even with their multiplicity, but in the minimization, you only obtain one solution.

$\endgroup$

marked as duplicate by Dr. belisarius, Simon Woods, m_goldberg, bobthechemist, Michael E2 Mar 25 '14 at 14:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    $\begingroup$ NMinimize does not perform a global optimization, and will return only one (quite possibly local) minimum. You can try Minimze which will return a global minimum for polynomial functions, but not other (local) ones. $\endgroup$ – Yves Klett Mar 25 '14 at 10:32
  • 3
    $\begingroup$ related: How to find all the local minima/maxima in a range. About infinite domain, Solve for f' == 0 && f'' >0. $\endgroup$ – Kuba Mar 25 '14 at 10:35
  • 1
    $\begingroup$ @Kuba: Nice answer in that link, thanks for posting, had not seen it before. $\endgroup$ – ciao Mar 25 '14 at 10:41