Differentiable approximation $f(x) = x$ for $x>0$ and $0$ otherwise. I would like to find a twice continuously differentiable approximation of 
$$f(x)= \begin{cases} 
      0 & x\leq 0 \\
      x & x>0. \\
   \end{cases}$$
Are there any approximations which are not defined piece-wise? Ideally, I'd like an approximation that will allow me to control the error given some norm.
 A: Consider
$$f(t)=
        \left\{ \begin{array}{cl}  
                                   0& \mbox{si $t\le0$}\\
                                   \exp(-1/t)& \mbox{si $t>0$}
                \end{array}
        \right.
$$
and for any $\delta>0$ set
$$
g_\delta(t)=\frac{\textstyle f(t)}{\textstyle f(t)+f(\delta-t)}.
$$
Then choose $\varepsilon>0$ and define $h(t)=tg_\delta(t-\varepsilon)$. One gets:

But I don't know whether this is what you didn't want... due to the piecewise definition of the first $f$. 
A: Try
$$
f(x) = \frac{\ln(1+e^{Kx})}{K}
$$
for some largeish value of $K$.
A: For a general method of approximation, the convolution is really usefull. Take a positive function of $C^{\infty}_c([-1,1])$, as an exemple, 
$$g(x) = \exp\left({-\frac{2}{(x-1)(x+1)}}\right)$$
Let's normalise it :
$$g_{norm}(x) = \frac{g(x)}{\int_{-1}^1 g(t) dt}$$
Then we define
$$g_{\epsilon}(x) = \frac{1}{\epsilon} g_{norm}(\frac{x}{\epsilon})$$
Then, for every $f \in L^1_{loc}$ you have that $g_{\epsilon} \star f \to f$ uniformly and that $g_{\epsilon} \star f \in C^{\infty}$ 
You also have $g_{\epsilon} \star f \to f$ in all $L^p$.
But I don't remember the error estimate...
