MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


I have the following function form as one of my constraints :

f(x) = MIN(0, x)

Because of the MIN, it is non-differentiable.

As I would like to use an optimizer that uses derivative based methods, I need my objective function and constraints to be differentiable.

How could I convert (or approximate) this function into a differentiable one?

Here is an example of data and the function chart, even if it is trivial.

share|cite|improve this question
Your question is somewhat vague. Are you defining the function $f(x)$ to be $\min(0,x)$, or is $f(x)$ a function that is already defined and you want to impose the constraint that $f(x)=\min(0,x)$? If you're defining $f(x)$ to be $\min(0,x)$, then how else does $f(x)$ appear in your problem? Does it appear in other constraints? Does it appear in the objective function? – Brian Borchers May 6 '11 at 18:41
The anti-derivative of a suitable bump function does what you want. – Ryan Budney May 6 '11 at 19:22
What if you add to your objective function the indicator function of $(-\infty,0]$, and then solved your problem with the proximal gradient method or FISTA ? – littleO Jul 31 '11 at 8:08
up vote 0 down vote accepted

You can try

$f(\xi) = \frac{\xi}{2}+\frac{\ln 2}{2k} + \frac{\ln(\cosh(k \xi)}{2k},$

whose derivative is

$f'(\xi) = \frac{1}{2} [\tanh(k \xi) + 1].$

This function approaches the maximum as $k\rightarrow \infty$ (change as needed for the minimum). Will this help solve your problem? Perhaps, if the lack of smoothness is not its essential feature - a question related to the domain of application, not strictly a mathematical issue.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.