ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 26 Jul 2024 20:50:48 +0200Minimize functionhttps://ask.sagemath.org/question/78455/minimize-function/ 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 Thu, 25 Jul 2024 21:10:20 +0200https://ask.sagemath.org/question/78455/minimize-function/Comment by Sotto for <p>Dear all,
how can I find the (approximate) minimum of a (polynomial) function f on [0,2]x[0,2]?</p>
<p>I tried with a simple example like f=x+y and</p>
<p>minimize(f, [0, 2], [0, 2])</p>
<p>but it does not work... I got (-2.42257561605609e+155, -2.42257561605609e+155)?!?</p>
<p>Thanks, N </p>
https://ask.sagemath.org/question/78455/minimize-function/?comment=78482#post-id-78482Dear 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 NicolaFri, 26 Jul 2024 20:50:48 +0200https://ask.sagemath.org/question/78455/minimize-function/?comment=78482#post-id-78482Comment by Emmanuel Charpentier for <p>Dear all,
how can I find the (approximate) minimum of a (polynomial) function f on [0,2]x[0,2]?</p>
<p>I tried with a simple example like f=x+y and</p>
<p>minimize(f, [0, 2], [0, 2])</p>
<p>but it does not work... I got (-2.42257561605609e+155, -2.42257561605609e+155)?!?</p>
<p>Thanks, N </p>
https://ask.sagemath.org/question/78455/minimize-function/?comment=78464#post-id-78464**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,Fri, 26 Jul 2024 09:55:38 +0200https://ask.sagemath.org/question/78455/minimize-function/?comment=78464#post-id-78464