# [SciPy-user] Minimize a bounded convex function

Geoffrey Zhu zyzhu2000@gmail....
Fri Oct 19 09:11:16 CDT 2007

```On 10/18/07, Robert Kern <robert.kern@gmail.com> wrote:
> Geoffrey Zhu wrote:
> > Hi Everyone,
> >
> > I am trying to minimize a convex function f(x) that is not defined
> > when x<=0 or when x>=1.5. I am trying to use scipy.optimize.golden(),
> > but when the minimal point is very close to zero, golden() will call
> > my target function on the undefined region. Is there any way to ensure
> > that the optimizer will only look for answers within the domain?
>
> Hmm. When you have an open interval like that, (0, 1.5) rather than [0, 1.5],
> you will pretty much have to find an espilon that suits your problem and use the
> bounds [0+eps, 1.5-eps]. With golden() and brent(), you can use the argument
> brack=(0+eps, 1.0, 1.5-eps). The 1.0 isn't special, you can pick anything in
> between since your problem is convex. For fminbound(), you can use x1=0+eps,
> x2=1.5-eps.
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>  that is made terrible by our own mad attempt to interpret it as though it had
>  an underlying truth."
>  -- Umberto Eco
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>

Hi Robert,

This works except one problem. Convexity does not ensure that f(1.0)
is smaller than f(0+eps) and f(1.5-eps).

Thanks,
Geoffrey
```