Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

set minimize function/value-tolerance

Hi,

can I somehow set function/value tolerances in sages minimizer? From sage's help(minimize) I don't see how.

sage: help(minimize)
minimize(func, x0, gradient=None, hessian=None, algorithm='default', **args)

The Problem: even for a trivial function with a 'shallow' minimum, say,

sage: f=(x-1)^10
sage: minimize(f,[.5])
Optimization terminated successfully.
         Current function value: 0.000000
         Iterations: 11
         Function evaluations: 12
         Gradient evaluations: 12
(0.790308276599)

That's not optimal. Sage seems to have some rather moderate default tolerances preset.

B.t.w. that's not the case in SciPy:

~> ipython -pylab -wthread
In [1]: from scipy.optimize import fmin
In [2]: def f(x):
   ...:     return (x-1.)**10
In [3]: fmin(f,.5)
Optimization terminated successfully.
         Current function value: 0.000000
         Iterations: 16
         Function evaluations: 32
Out[3]: array([ 1.])

So, Python's default tolerance is much stricter, even though, in principle, in that case I could change default tolerances.

In [4]: help(fmin)
fmin(func, x0, args=(), xtol=0.0001, ftol=0.0001, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None)

Finally, not speaking of Mathematica ;):

In[1]:= NMinimize[(x - 1)^10, x]
Out[1]= {1.11155*10^-68, {x -> 1.}}

Thanks for your help,

Xaver