import math


def smooth_abs(x, eps=1e-6):
    """
    A smooth, differentiable approximation of the absolute value.
    See http://www.cs.utep.edu/vladik/2013/tr13-44.pdf
    :param x: The value to take the absolute value of
    :param eps:
    """
    assert eps > 0
    return math.sqrt(pow(x, 2) + eps)