Minimize function

asked 2024-07-25 21:10:20 +0100

Sotto gravatar image

Dear all, how can I find the (approximate) minimum of a (polynomial) function f on [0,2]x[0,2]?

I tried with a simple example like f=x+y and

minimize(f, [0, 2], [0, 2])

but it does not work... I got (-2.42257561605609e+155, -2.42257561605609e+155)?!?

Thanks, N

edit retag flag offensive close merge delete

Comments

Not a full answer. If you seek numerical answers, minimize_constrained? might be a useful inspiration. Othewise, you must :

  • find the positions of the extrema of your function (=points of null gradient),

  • if any,

    • check in they lie in your search domain,

    • if so, check if these extrema are minima, maxima or saddle points (check the second derivatives)

  • if not, build a function walking the perimeter of your domain and search a minimum of your function on this perimeter.

HTH,

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-07-26 09:55:38 +0100 )edit

Dear Emmanuel can you write the code for a simple example (polynomial function) for instance over [0,1]x[0,1] using minimize_constrained? What I hope to find is the (absolute) minimum value of f. I would like to use this procedure in a loop where I change the coefficients of the polynomials so I prefer to avoid using the gradient, Hessian matrix, evaluating the function on the border etc. I'm just interested in an approximate answer. Thanks Nicola

Sotto gravatar imageSotto ( 2024-07-26 20:50:48 +0100 )edit