Hướng dẫn dùng scipy.optimize.minimize python

scipy.optimize.minimize_scalar[fun, bracket=None, bounds=None, args=[], method='brent', tol=None, options=None][source]#

Minimization of scalar function of one variable.

Parametersfuncallable

Objective function. Scalar function, must return a scalar.

bracketsequence, optional

For methods ‘brent’ and ‘golden’, bracket defines the bracketing interval and can either have three items [a, b, c] so that a > from scipy.optimize import minimize_scalar >>> res = minimize_scalar[f] >>> res.x 1.28077640403

Using the Bounded method, we find a local minimum with specified bounds as:

>>> res = minimize_scalar[f, bounds=[-3, -1], method='bounded']
>>> res.x
-2.0000002026

Chủ Đề