Matlab has a command that when is used in fminsearch shows the value of the function which we want to minimize and so gives a trend of values calculated for the minimum. It is something like this for a specific problem:

enter image description here

What is the equivalent command in MMA?


Try something like this:

Let's make up a "slow to evaluate" function to minimize:

f[x_] := (Pause[0.5]; x^4 - x^2)

Some setup:

values = {};
Dynamic@ListPlot[values, PlotRange -> All, Frame -> True]

Now run FindMinimum and watch the function values decrease in real time:

FindMinimum[f[x], {x, 1}, StepMonitor :> AppendTo[values, f[x]]]
  • $\begingroup$ Sometimes it crashes. MMA asks me to either disable dynamic updating or wait for it to work. $\endgroup$ – MOON Nov 1 '14 at 21:35

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.