Logs and Exponentials
log, log2, log10 and exp are ufuncs. Use log1p and expm1 for small values.
Example
a = np.array([1, 10, 100])
print(np.log10(a), np.log2([1, 2, 8]))
print(np.exp([0, 1]).round(3), np.log(np.e))Result
[0. 1. 2.] [0. 1. 3.] [1. 2.718] 1.0
Exercise
Base 10 log.
np.(a)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.