newton.utils.boltzmann#

newton.utils.boltzmann(a, b, alpha)[source]#

Compute the Boltzmann-weighted average of two values.

This function returns a smooth interpolation between a and b using a Boltzmann (softmax-like) weighting, controlled by the parameter alpha. As alpha increases, the result approaches max(a, b); as alpha decreases, the result approaches the mean of a and b.

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

  • b (float) – The second value.

  • alpha (float) – The sharpness parameter. Higher values make the function more “max-like”.

Returns:

The Boltzmann-weighted average of a and b.

Return type:

float