Q:

Write a NumPy program to compute the natural logarithm of one plus each element of a given array in floating-point accuracy

0

Write a NumPy program to compute the natural logarithm of one plus each element of a given array in floating-point accuracy.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x = np.array([1e-99, 1e-100])
print("Original array: ")
print(x)
print("\nNatural logarithm of one plus each element:")
print(np.log1p(x))
Sample Output:
Original array: 
[1.e-099 1.e-100]

Natural logarithm of one plus each element:
[1.e-099 1.e-100]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now