Learn R Programming

RTMBdist (version 1.0.1)

abs_smooth: Smooth approximation to the absolute value function

Description

Smooth approximation to the absolute value function

Usage

abs_smooth(x, epsilon = 1e-06)

Value

Smooth absolute value of x.

Arguments

x

vector of evaluation points

epsilon

smoothing constant

Details

We approximate the absolute value here as $$\vert x \vert \approx \sqrt{x^2 + \epsilon}$$

Examples

Run this code
abs(0)
abs_smooth(0, 1e-4)

Run the code above in your browser using DataLab