单调性 [1 + 1 / (n)]^n
Posted yuanjiangw
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了单调性 [1 + 1 / (n)]^n相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章
BZOJ2216[Poi2011]Lightning Conductor 决策单调性