I need to minimize a function that has several problem points (divergences).
For example, if I consider:
f[xx_] := Limit[Sin[x]/x, x -> xx];
FindMinimum[{f[xx], 5 >= xx && xx >= -5}, {xx, 0}]
The FindMinimum falls due to the divergence that exists at x = 0 and does not consider the limit of the function.
Is there any function to do that?. I have thought about using NMinimize but I don't know if it will be as effective as FindMinimum.
The sin (x) / x function was an example, the function I have to evaluate has multiple repairable divergences whose points I don't know.
I tried the following but it doesn't work either:
ff[x_] := Sin[x]/x;
g[xx_] := Piecewise[{{Limit[ff[x], x -> xx], SameQ[ff[xx], Indeterminate]}, {ff[xx], NumericQ[ff[xx]] == True}}]
FindMinimum[g[xx], {xx, 0}]
It does not yield a value, findfinimum fails