Search code examples
optimizationwolfram-mathematicamaximization

Maximizing in mathematica with multiple maxima


I'm trying to compute the maxima of some function of one variable (something like this:) plot

(which is calculated from a non-trivial convolution, so, no, I don't have an expression for it)

Using the command:

NMaximize[{f[x], 0 < x < 1}, x, AccuracyGoal -> 4, PrecisionGoal -> 4]

(I'm not that worried about super accuracy, a rough estimate of 10^-4 is already enough)

The result of this is x* = 0.55, which is not what should be. (i.e., it is picking the third peak).

Is there any way of telling mathematica that the global maxima is the first one when counting from x = 0 (I know this is always true), or make mathematica search with a better approach? (Notice, I don't want things like Stimulated Annealing approach; each evaluation is very costly!)

Thanks very much!


Solution

  • Try FindMaximum with a starting point of 0 or some similarly small value.