I am looking for a function $f\colon \mathbb{R}\to\mathbb{R}$ such that $$g(x)=\begin{cases} f(x), &\text{if }| x|<k \\ | x|, &\text{otherwise}\end{cases}$$ is $C^2$ or $C^\infty$ (at least twice continuously differenciable).
I also wish that the deviations between $| x|$ and $g(x)$ tends to $0$ as $k\to0$, possibly uniformly, as well as the deviations of the first two derivatives.
If possible, I am looking for a parametric class of symetric functions f for which computations are explicit and do not require heavy numerical procedure. I guess a polynomial class would do it, requiring only a linear solver, but there may be other solutions.
Thank you for your ideas.