简体   繁体   English

OverflowError:(34,“结果太大”)计算e ^-(b * dE)

[英]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. b1/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得到的值kimport math得到的值e dE and T are integer. dET是整数。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM