Are there any good approximations of the absolute value function which are $C^2$ or at least $C^1$? I've thought about working with exponentials and then adding in more terms to keep the function from growing too fast away from zero, but I was hoping to find something a bit neater.
2026-03-27 21:32:57.1774647177
On
Differentiable approximation of the absolute value function
8.8k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
3
There are 3 best solutions below
2
On
How about $$ \newcommand{\abs}[1]{\left\lvert#1\right\rvert} f_\epsilon(x) = \begin{cases} \abs{x} & (\abs{x} \geqslant \epsilon) \\ \abs{x}\left(1 - e^{\textstyle\frac{x^2}{x^2 - \epsilon^2}}\right) & (\abs{x} < \epsilon) \end{cases} $$ [I'm reminded of Littlewoood's anecdote, "$\ldots$ where $\epsilon$ is very small"! Can one fix this in MathJax?]
If my magnifying glass can be relied upon, the exponent in that expression is: $$ \frac{x^2}{x^2 - \epsilon^2}. $$
If I'm not mistaken, $f_\epsilon$ is $C^\infty$ on $\mathbb{R} \setminus\{0\}$, and $C^1$ at $0$; $f_\epsilon''(0) = 0$; and $0 \leqslant f_\epsilon(x) \leqslant \epsilon$ if $\abs{x} \leqslant \epsilon$.

A "natural" approximation of $x \mapsto |x|$ is given by the hyperbola $$x \mapsto \sqrt{x^2+c}$$ for some $c > 0$.