# How to obtain all minima? [duplicate]

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.

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

• 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. – Yves Klett Mar 25 '14 at 10:32
• related: How to find all the local minima/maxima in a range. About infinite domain, Solve for f' == 0 && f'' >0. – Kuba Mar 25 '14 at 10:35