newton.utils.smooth_min#

newton.utils.smooth_min(a, b, eps)[source]#

Compute a smooth approximation of the minimum of two values.

This function returns a value close to min(a, b), but is differentiable everywhere. The eps parameter controls the smoothness: larger values make the transition smoother.

Parameters:
  • a (float) – The first value.

  • b (float) – The second value.

  • eps (float) – Smoothing parameter (should be small and positive).

Returns:

A smooth approximation of min(a, b).

Return type:

float