Function cont_lower_bound (o2scl)

O2scl : Function List

inline double o2scl::cont_lower_bound(double x, double center, double width, double height, double tightness = 40.0, double exp_arg_limit = 50.0)

Constrain x to be greater than the value given by center.

Defining \( c= \) center, \( w= \) width, \( h= \) height, \( t= \) tightness, and \( \ell= \) exp_arg_limit, this returns \( h(c-x+w)/(w+w\exp(t(x-c)/w)) \) and has the advantage of being a continuous and differentiable function. The value of the function exactly at \( x=c \) is \( h/2 \), but for \( x \) just below \( c \) the function is \( h \) and just above \( c \) the function is quite small.

The exponential is handled gracefully by assuming that anything smaller than \( \exp(-\ell) \) is zero. This creates a small discontinuity which can be removed with the sufficiently large value of \( \ell \).

It is important to note that, for large distances of x from center, this only scales linearly. If you are trying to constrain a function which decreases more than linearly by making x far from center, then a minimizer may ingore this constraint.

In the limit \( t \rightarrow \infty \), this function converges towards lower_bound(), except exactly at the point \( x=c \).