1

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$.

  • Welcome to MSE. Remember to include your work on the problem. – jjagmath Apr 13 '21 at 00:38
  • I haven't had much success with this, and was thinking about it. This is a question of my own making, when I saw smooth approximations to the step function. – manofwar Apr 13 '21 at 00:46
  • 1
    You should specify more about the function you are asking for. How close to the ramp function the approximation should be? Does it need to be linear for $x$ far away from $0$? – jjagmath Apr 13 '21 at 00:46

1 Answers1

1

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.

GuPe
  • 7,518
  • Thank you for this. This function is infinitely smooth, if I am correct. What would be a good way to achieve the desired smoothness ($C^1$ or $C^2$)? – manofwar Apr 13 '21 at 01:20
  • @manofwar note that $b(x)$ has the form $f(1/x)$ for $x>0$ with $f(x)\to 0$ as $x\to \infty$. Intuitively, one picks a function that vanishes at infinity and then inverts the real line so it vanishes (along with some of its derivatives) at $0$. In order to lose regularity of the approximation, all you need is to pick an $f$ which vanishes slower at infinity (for instance $f(x)=(1+x^2)^{-1}$). – GuPe Apr 13 '21 at 01:27