logaddexp¶
- logaddexp(x1: array | int | float, x2: array | int | float, /) array¶
Calculates the logarithm of the sum of exponentiations
log(exp(x1) + exp(x2))for each elementx1_iof the input arrayx1with the respective elementx2_iof the input arrayx2.- Parameters:
x1 (Union[array, int, float]) – first input array. Should have a real-valued floating-point data type.
x2 (Union[array, int, float]) – second input array. Must be compatible with
x1(see Broadcasting). Should have a real-valued floating-point data type.
- Returns:
out (array) – an array containing the element-wise results. The returned array must have a real-valued floating-point data type determined by Type Promotion Rules.
Notes
At least one of
x1orx2must be an array.
Special cases
For floating-point operands,
If either
x1_iorx2_iisNaN, the result isNaN.If
x1_iis+infinityandx2_iis notNaN, the result is+infinity.If
x1_iis notNaNandx2_iis+infinity, the result is+infinity.
Changed in version 2024.12: Added scalar argument support.