Skip to content

smoothMax

Once continuously differentiable approximation of max(x1, x2)

FastSmoothBuildings.Utilities.smoothMax, function (source)

Purpose

Once continuously differentiable approximation of max(x1, x2), without events (see Smoothing).

Equations

y = regStep(x1 − x2, x1, x2, Δx): y = x1 when x1 − x2 > Δx, y = x2 when x1 − x2 < −Δx, and in between a weighted mean of the two arguments whose weight goes from 0 to 1 along the cubic of regStep.

The result is exact outside the blend and continuous with its first derivative (C1). Inside the blend it lies between the two arguments, at most 0.087 Δx below max(x1, x2); it equals it when x1 = x2.

Use

deltaX (> 0) is the half width of the blend, in the unit of the arguments. The arguments are those of Buildings.Utilities.Math.Functions.smoothMax.

Revisions

  • October 2026: moved from trano's FastModel.Utilities.