How can I find global minimum for the function: (what is the function name?)
ff[x_] := 0.01*(x + 20) + 0.001*(x + 20)^2 + Sin[(x + 20)] + 20
Plot[ff[x],{x,-222,222}]
How can I find global minimum for the function: (what is the function name?)
ff[x_] := 0.01*(x + 20) + 0.001*(x + 20)^2 + Sin[(x + 20)] + 20
Plot[ff[x],{x,-222,222}]
As a supplement to the solution of rhermans
ff[x_]= 0.01*(x + 20) + 0.001*(x + 20)^2 + Sin[(x + 20)] + 20;
tab = Table[{x, ff[x]}, {x, -222, 222, 0.001}];
{x, ff} = MinimalBy[tab, Last] // Flatten
{-27.848, 18.9831}
Your function is a parabola plus a sinusoidal. The parabola has minimum at x-> -25 that you can find like this
Minimize[0.01*(x + 20) + 0.001*(x + 20)^2 + 20, x]
{19.975, {x -> -25.}}
or
Solve[D[0.01*(x + 20) + 0.001*(x + 20)^2 + 20, x] == 0, x]
{{x -> -25.}}
For your particular function, there will be many local minima, so the initial guess is important. here I use FindMinimum with an initial guess given by the minimum of the parabola.
{x, ff[x]} /. FindMinimum[ff[x], {x, -25}][[2]]
{-27.8483, 18.9831}
Or you could use Minimize giving constrains around x->-25. Notice that without constrains it will not find the global minimum.
Minimize[{ff[x], -50 < x < 0}, x]
{18.9831, {x -> -27.8483}}
you can see the result in a Plot by placing a Point in an Epilog
Plot[ff[x], {x, -50, 0},
Epilog -> {Red, PointSize[Large],
Point[{x, ff[x]} /. FindMinimum[ff[x], {x, -25}][[2]]]}]