[英]OverflowError: (34, 'Result too large') calculate e^-(b*dE)
I want to calculate boltzmann distribution which is e**-(b*dE)
. 我要计算的boltzmann分布为e**-(b*dE)
。 b
is 1/kT
where k
is boltzmann constant and T
is temperature. b
是1/kT
,其中k
是博茨曼常数, T
是温度。 dE
is delta energy. dE
是增量能量。
I use from scipy.constants import k
to get the value of k
and import math
to get the value of e
. 我用from scipy.constants import k
得到的值k
和import math
得到的值e
。 dE
and T
are integer. dE
和T
是整数。
Is there any library that can import to get the value of e^-(b*dE)
easily? 是否可以导入任何库以轻松获得e^-(b*dE)
的值?
You should not use the ^
(xor) operator, but **
(pow): 您不应使用^
(xor)运算符,而应使用**
(pow):
e**-(b*dE)
Or: 要么:
import math
math.exp(-(b*dE))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.