positivePart¶
Smooth max(x, 0): 0.5(x + sqrt(x^2 + delta^2))*
FastSmoothBuildings.Utilities.positivePart, function (source)
Purpose
Smooth approximation of max(x, 0), strictly positive: a flow or a cosine that can divide or weight without a singularity at 0.
Equations
y = (x + √(x2 + δ2))/2.
Infinitely differentiable (C-infinity) for δ > 0. Always above max(x, 0): y = δ/2 at x = 0, and the difference (√(x2 + δ2) − |x|)/2 tends to δ2/(4|x|) for |x| >> δ: y tends to 0 for x → −∞ and to x for x → ∞.
Use
delta is the width of the rounding, in the unit of x; unlike
smoothMax, the result is nowhere exact.
Revisions¶
- October 2026: moved from trano's
FastModel.Utilities.