How to find out Boltzmann weight or partition function at low temperature?

Viewed 190

In statistical physics, we often try to find out the partition function which is expressed as

Z=\sum_i e^(-\beta E_i) where \beta is inverse temperature. e^(-\beta E_i), the term under the summation is called the Boltzmann weight.

Now at low temperature, \beta becomes quite large and we face a situation where we have to calculate the exponential of a very large positive or negative number (depending on the sign of E_i).

In normal programming language (e.g. Python), the intrinsic exponential function gives infinity for e^x if x>=1000.

For instance, in Python 3, I tried to estimate in terms of Taylor series expansion:

x = 1000
n = int(input('Enter number of terms in Taylor series\n'))

# Taylor Series expansion up to n-th term
def exponential(n, x):
        sum = 1.0
        for i in range(n, 0, -1):
                sum = 1 + x * sum / i
        return sum


print('e^x =',exponential(n, x))

However, the result varies for n <= 300 and becomes inf for n >= 400.

Can we ever calculate the partition function for large beta (at least in the power of 10)? Could there be some trick?

1 Answers
Related