码迷,mamicode.com
首页 > 其他好文 > 详细

单调性 [1 + 1 / (n)]^n

时间:2019-04-09 12:27:04      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:bre   pre   3.0   turn   imp   range   def   ret   from   

 

def f(n):
n += 0.0
s = 1 + 1 / (n)
r = pow(s, n)
print(n, ‘,‘, r)
return r


l = []
for i in range(1, 1000000, 1):
s = f(i + 1) - f(i)
print(s)
if s <= 0:
print(i, ‘:‘, s)
l.append(i)
if len(l) > 50:
break
print(l)
l = [132360, 132917, 133630, 134042, 135058, 135334, 135537, 135602, 135846, 135890, 135953, 136232, 136307, 136316,
136372, 136610, 136779, 136992, 137004, 137056, 137066, 137084, 137153, 137322, 137383, 137587, 137726, 137905,
137942, 137991, 138164, 138254, 138423, 138466, 138489, 138642, 138932, 138957, 139056, 139339, 139363, 139406,
139465, 139531, 139550, 139563, 139595, 139640, 139666, 139752, 139782]


139783.0 , 2.718272105261508
139782.0 , 2.7182721052675713
-6.063149982082905e-12
139782 : -6.063149982082905e-12
[132360, 132917, 133630, 134042, 135058, 135334, 135537, 135602, 135846, 135890, 135953, 136232, 136307, 136316, 136372, 136610, 136779, 136992, 137004, 137056, 137066, 137084, 137153, 137322, 137383, 137587, 137726, 137905, 137942, 137991, 138164, 138254, 138423, 138466, 138489, 138642, 138932, 138957, 139056, 139339, 139363, 139406, 139465, 139531, 139550, 139563, 139595, 139640, 139666, 139752, 139782]

 



from decimal import *
def f(n):
n += 0.0
s =Decimal(1 + 1 / (n))
r = pow(Decimal(s), Decimal(n))
print(n, ‘,‘, r)
return r
l = []
for i in range(1, 1000000, 1):
s = f(i + 1) - f(i)
print(s)
if s <= 0:
print(i, ‘:‘, s)
l.append(i)
if len(l) > 50:
break
print(l)

139783.0 , 2.718272105261508172529079121
139782.0 , 2.718272105267571503080835127
-6.063330551756006E-12
139782 : -6.063330551756006E-12
[132360, 132917, 133630, 134042, 135058, 135334, 135537, 135602, 135846, 135890, 135953, 136232, 136307, 136316, 136372, 136610, 136779, 136992, 137004, 137056, 137066, 137084, 137153, 137322, 137383, 137587, 137726, 137905, 137942, 137991, 138164, 138254, 138423, 138466, 138489, 138642, 138932, 138957, 139056, 139339, 139363, 139406, 139465, 139531, 139550, 139563, 139595, 139640, 139666, 139752, 139782]

 

单调性 [1 + 1 / (n)]^n

标签:bre   pre   3.0   turn   imp   range   def   ret   from   

原文地址:https://www.cnblogs.com/yuanjiangw/p/10676067.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!