2
$\begingroup$
f[t_] := Sin[t]*Cos[10*t]*(E^(-t/4) - E^(-t))
pt1 = {t  /. #[[2]], #[[1]]} & @NMaximize[{f[t], 0 < t < 10}, t]
pt2 = {t  /. #[[2]], #[[1]]} & @NMinimize[{f[t], 0 < t < 10}, t]
Plot[{f[t]}, {t, 0, 10}, Epilog -> {Red, PointSize[Large], Point[ {pt1, pt2}]}]

I am not getting the minimum value of f[t] in the range 0 < t < 10. Any suggestion on how to get the correct minimum value?

$\endgroup$
  • $\begingroup$ In NMaximize and NMinimize use Method -> "SimulatedAnnealing", MaxIterations -> 500. $\endgroup$ – Stephen Luttrell Sep 30 '14 at 8:33
  • 1
    $\begingroup$ In this case just replacing NMaximize and NMinimize with Maximize and Minimize works. $\endgroup$ – Rahul Sep 30 '14 at 9:34
1
$\begingroup$
NMinimize[{f[t], 0 < t < 10}, t, Method -> SimulatedAnnealing]
{-0.467368, {t -> 1.57162}}
$\endgroup$
  • $\begingroup$ If I change the function to f[t_] := Sin[10*t]*Cos[100*t]*(E^(-t/4) - E^(-t)), I don't seem to get the max and min using Method-> SimulatedAnnealing. I wonder how robust is the method? $\endgroup$ – user11946 Sep 30 '14 at 4:15
  • $\begingroup$ @user11946 I suggest you take a look at the tutorial here: reference.wolfram.com/language/tutorial/… $\endgroup$ – dr.blochwave Sep 30 '14 at 7:51
  • 1
    $\begingroup$ There is no method which will work 100% of the time, and in finite time. $\endgroup$ – Igor Rivin Sep 30 '14 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.