I'm trying to smooth a piecewise function in order to make the gradient continuous for an optimisation problem. I want to restore the main gradients in each of the piecewise components.
The piecewise function is
1. S = Y - N where Y-N > beta * Y
2. S = beta * Y otherwise
Can anyone point me in the right direction?