1

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!

Jorge Leitao
  • 19,085
  • 19
  • 85
  • 121
  • Have you tried FindMaximum with a starting point of 0 (or some similarly small value) ? – High Performance Mark Apr 12 '12 at 09:51
  • Ok. I think that solved the problem. I have tried that before, but I forgot to define f(0) (which is = 0), so it was keeping sending errors to the console of indeterminate, but the pc was muted, so I didn't knew... -.- Can you post an answer, so I can accept it? – Jorge Leitao Apr 12 '12 at 10:11

1 Answers1

4

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

High Performance Mark
  • 77,191
  • 7
  • 105
  • 161