ネイピア数は指数関数a^xを微分しても、元のa^xになるようにaを選んだもので、その時のaをeと記述しネイピア数と呼んでいます。式で表すと以下のようになります。
\begin{equation} \frac{d e^x}{d x} = e^x \end{equation}
ネイピア数は上の微分の式から、微分の定義に従って求めてみると、以下の式で表すことができることが、わかります。
\begin{equation} e= \lim_{n \to \infty} \left( 1+\frac{1}{n}\right) ^n \end{equation}
数値計算でnをだんだん大きくして求めていきその様子をグラフ化して見ます。
#ここからソース
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
x=np.linspace(0,100,1000) | |
y=(1+1/x)**x | |
plt.plot(x,y) | |
plt.grid() | |
plt.show() | |
print(y[-1]) |
0 件のコメント:
コメントを投稿