Previous Up Next

16.3.1  Univariate global minimization on a segment

The find_minimum command is used for global minimization of a continuous function on a segment.

Examples

We minimize a function which has several local extrema, one of which is global.

f(x):=Airy_Ai(x+sin(x))+cos(x^2):; x0:=find_minimum(f(x),-5,5)
     
−3.96344565209           
plot(f(x),x=-5..5); point(x0,f(x0),display=point_width_3+point_point+red)

The objective function in the example below is unimodal, with a single local minimum which is also the global minimum.

f(x):=besselJ(x,2)/Gamma(x+1)+(x+1)^sin(x):; x0:=find_minimum(f(x),0,10)
     
4.82843934915           
plot(f(x),x=0..10); point(x0,f(x0),display=point_width_3+point_point+red)

The function f defined below is continuous but not differentiable. It has three local and only one global minimum at x0=−1. Note that we are passing the function itself as the first argument. Also, the parameters ε and n are set to 10−5 and 30, respectively.

f(x):=min(sqrt(abs(x+4))-1,sqrt(abs(x+1))-1005/1000,sqrt(abs(x-3))+1/2):; x0:=find_minimum(f,-5,5,1e-5,30)
     
−0.999998230068           
plot(f(x),x=-5..5,xstep=5e-4); point(x0,f(x0),display=point_width_3+point_point+red)

Previous Up Next