The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Erlang B

Date: 10/22/2002 at 14:11:22
From: Jamie  Bell
Subject: Logarithms

I need to know how to calculate the addition of numbers using 
logarithms: 1 + 2 + 3

I have a formula in an Excel file that produces numbers large enough 
to exceed Excel's calculation limits; e.g.: 200! and 10^1000.  I have 
converted all of the factorial and expotential expressions to logs, 
but there is a step that requires adding numbers that exceed Excel's 
limits. How can I use logs to add the numbers?

The formula is Erlang B:

   P = (A^N/N!) / Sum 0 through N of A^n/n!


Date: 11/14/2002 at 17:00:01
From: Doctor Peterson
Subject: Re: Logarithms

Hi, Jamie.

There are some useful things to say that have nothing to do with 

Here is one page I found that will be useful to you:

A Robust and Efficient Algorithm for Evaluating Erlang's Formula - 
Erlang B - Dave Albert, Jun Zhu 

This gives a modified version of the formula that is easier to use. 
I'll explain and derive it in what I think is a clearer form.

We can avoid calculating factorials when we are able to cancel, as is 
usually done in calculating combinations. We can do that in this case 
by distributing the numerator; that is, we can divide the numerator 
and denominator by A^N/N!:

    P = --------------------
        Sum[k=0 to N] A^k/k!

      = ------------------------------
        Sum[k=0 to N] (A^k/k!)(N!/A^N)

      = ------------------------------------
        Sum[k=0 to N] (N!/k!)/A^(N-k)

      = ------------------
        Sum[k=0 to N] a[k]


    a[k] = -------, for k=0 to N

Look at the sequence a[k]:

    a[0] = ------------------

    a[1] = ---------------

    a[2] = ------------
    a[N-1] = ---

    a[N] = ---

We can calculate the sequence a[k] recursively in reverse (starting 
from a[N] and working back to a[0]), as

    a[N] = 1
    a[k-1] = a[k] * k/A  for k=N to 1

You will never get large numbers when you calculate this way, and 
will have as much precision as you can get. You can do it in a simple 
loop, adding in each a[k] as you calculate it, and then taking the 
reciprocal of the result.

If you have any further questions, feel free to write back.

- Doctor Peterson, The Math Forum 
Associated Topics:
College Algorithms
High School Calculators, Computers
High School Logs

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.