Logs

$$ \log(ab) = \log(a) + \log(b) $$

In [3]:
import math

print(math.log(0.2) + math.log(0.5))
print(math.log(0.2 * 0.5))


-2.3025850929940455
-2.3025850929940455
$$ \log \exp(a) = a $$$$ \log (\exp(a) \exp(b)) = \log(\exp(a)) + \log(\exp(b)) = a + b $$

In [4]:
print(math.log(math.exp(0.2) * math.exp(0.7)))
print(0.2 + 0.7)


0.9
0.8999999999999999
$$ \log \frac{\exp(a)}{\exp(b)} = \log(\exp(a)) - \log(\exp(b)) = a - b $$

Using product rule, and confirming from https://en.wikipedia.org/wiki/Exponential_function:

$$ \frac{d}{dx} \exp(f(x)) = \frac{df(x)}{dx} \exp(f(x)) $$