Smooth approximations to the ramp function

426 Views Asked by At

I am looking for $C^1$ and $C^2$ continuous approximations to the ramp function, f(x), that satisfy the condition $f(x)=0$, $x\leq0$ (essentially smoothing out the discontinuity in the first derivative at $x=0$). Any help in this regard is appreciated.

Edit: The ramp function should be linear away from $x=0$ (essentially smoothing out the kink in the neighborhood of $x=0$.

1

There are 1 best solutions below

2
On

A simple smooth approximation could be to use the bump function $$b(x) = \begin{cases} 0 & x \le 0\\ e^{-1/{ax}} & x > 0 \end{cases} $$ with $ a> 0$ to approximate the step function and then you can just take $xb(x)$. Letting $ a\to\infty$ will give progressively better approximations.