natural logarithm
오일러수(네이피어수)
$$ \lim_{n \to \infty} \left( 1 + \frac{1}{x} \right)^n $$
$$ \lim_{n \to 0} \left( 1 + {x} \right)^\frac{1}{n} $$
import numpy as np
print(np.e)
$$ y = e^x $$
import numpy as np
print(np.exp(2)) # e의 제곱
그래프 확인
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
x = np.linspace(-2, 2)
y = np.exp(x) # 네이피어수의 거듭제곱
plt.plot(x, y)
plt.xlabel("x", size=14)
plt.ylabel("y", size=14)
plt.grid()
plt.show()
자연로그
$$ y = a^x, x = \log_{a} y $$
$$ y = e^x, x = \log_{e} y $$
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0.01, 2) # x를 0으로 할 수는 없다
y = np.log(x) # 자연대수
plt.plot(x, y)
plt.xlabel("x", size=14)
plt.ylabel("y", size=14)
plt.grid()
plt.show()