import numpy as np
l1 = np.log(1e-50)
l2 = np.log(2.5e-50)
print("Logarithm of the sum of exponentiations:")
print(np.logaddexp(l1, l2))
print("Logarithm of the sum of exponentiations of the inputs in base-2:")
print(np.logaddexp2(l1, l2))
Sample Output:
Logarithm of the sum of exponentiations:
-113.876491681
Logarithm of the sum of exponentiations of the inputs in base-2:
-113.599555228
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer