summaryrefslogtreecommitdiff
path: root/fun_math/e.py
diff options
context:
space:
mode:
authorzhang <zch921005@126.com>2019-12-15 12:39:06 +0800
committerzhang <zch921005@126.com>2019-12-15 12:39:06 +0800
commit1f7c93bfdfadfdaca268997658572c673d8f9f11 (patch)
treea50ea55f9e2fa2008ae7bf4b91a0b12b54dfa5fd /fun_math/e.py
parentee9158397a341fd448c21d14baa96bb38e6c47f3 (diff)
序列逼近自然常数
Diffstat (limited to 'fun_math/e.py')
-rw-r--r--fun_math/e.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/fun_math/e.py b/fun_math/e.py
new file mode 100644
index 0000000..5b44ef8
--- /dev/null
+++ b/fun_math/e.py
@@ -0,0 +1,15 @@
+
+import matplotlib.pyplot as plt
+import math
+
+
+def fn(n):
+ return (1+1/n)**n
+
+
+
+if __name__ == '__main__':
+
+ plt.plot(range(1, 500), list(map(fn, range(1, 500))), marker='.')
+ plt.hlines(y=math.e, xmin=0, xmax=500, ls='dashed', color='gray')
+ plt.show()