You are on page 1of 4

Evaluation of the Erlang-B formula

Ondřej Hudousek
Department of Telecommunication engineering
Czech Technical University in Prague, Faculty of Electrical Engineering
Technická 2
166 27 Praha 6 - Dejvice
E-mail: hudouso@feld.cvut.cz

Abstract 2 Evaluation of E1,N (A) for in-


This article sums up the methods of evaluation of teger number of circuits
the Erlang-B formula. In addition to known appro-
Direct evaluation of E1,N (A) according to the
aches, some improvements of the evaluation leading
definition would be time consuming. Therefore, a
to its acceleration are introduced.
recurrent form of the formula is used widely:
A · BN
E1,N +1 (A) = BN +1 = , B0 = 1.
1 Introduction N + 1 + A · BN
(3)
Erlang-B is probably the most important formula
used for dimensioning of the loss systems classified Concerning a real implementation it is better to
M/M/N/0 according to Kendall’s classification. Its evaluate the reciprocal value of E1,N (A):
aim is to determine the probability of loss based 1 N
on the offered traffic and the number of circuits. It IN (A) = = 1 + IN −1 , I0 = 1. (4)
E1,N (A) A
is often necessary to evaluate it with a prescribed
accuracy. As it is used repeatedly in some appli- Due to constant offered traffic A during the eva-
cations, the speed of the evaluation might be signi- luation it is possible to multiply by the recipro-
ficant. cal value 1/A instead of dividing by the value A.
The basic form of the Erlang-B formula for an This accelerates the evaluation considerably as it is
integer number of circuits is: shown in the table1 . It is also possible to substitute
the incrementation of a temporary variable with
AN 1/A for multiplication N (1/A), which also results
E1,N (A) = BN = PNN ! Ai
, (1) in faster evaluation.
i=0 i! n 30 60 90 120 480 1890
td [µs] 2.1 4.1 6.2 8.2 32.6 128.2
where B is loss probability,
to [µs] 0.8 1.4 2.0 2.7 10.4 40.9
A offered traffic,
N number of circuits. Table 1: Time of evaluation of the Erlang-B2
1 Duration of the evaluation was measured using RDTSC

instruction (see [6]). Due to a wide variety of available


processors and other impacts,the character of the above-
A generalized version of the formula is available for
mentioned values is only informative. The measuring was
a non-integer number of circuits: performed on Intel Pentium III running at 800 MHz, using
MS Windows 2000 and time critical priority of the process.
Ax e−A 2 t – time of evaluation for direct implementation of the
d
E1,x (A) = R ∞ x −t . (2) recurrent formula, to – optimized version, N stays for num-
A t e dt ber of circuits. Loss probability is B = 0.01.
Another approach to fastening the evaluation is The approximating function is directly used in the
via the approximation according to [1]. It can be interval x ∈ h0..1i. For x > 1 a fractional part of
shown that: the loss probability is determined. The final value
of the approximation is evaluated using equation
I0 = 1, (5) (3) which is also valid for N ∈ R.
1
I1 = 1+ , (6)
A 3.2 Szybicky’s approximation
Another approximation was developed by Ed-
2 1 2 1·2
I2 = 1+ 1+ = 1 + + 2 , (7) mund Szybicky [4]. It is intended to be used on in-
A A A A terval x ∈ h0..2i and it equals to E1,x (A) in points
···
N N (N − 1) N! x = 0, 1, 2.
IN = 1+ + 2
+ · · · + N (8)
A A A (2 − x) · A + A2
N E1,x (A) ≈ . (14)
X 1 N! x + 2A + A2
= 1+ i (N − i)!
. (9)
A
i=1 For x > 2 it is again possible to use the approxi-
mation in conjunction with the recurrent formula
It is not necessary for large A and N to count in all
(3).
terms of the sum in the equation (9). The difficulty
of this approach lies in finding out the appropri-
ate number of terms to achieve a desired accuracy. 3.3 Expansion of incomplete gamma
It is possible to accelerate the algorithm partially function into continued fraction
even by checking whether the value IN is not higher
G.Lévy-Soussan suggested in [2] using expan-
than the predefined value 1/E1,N . This approach is
sion of incomplete gamma function into continued
suitable for very large values of the offered traffic.
fraction.

3 Evaluation of E1,x (A) for 3.3.1 Continued fraction


non-integer number of cir- According to Lévy-Soussan the expansion into
continued fraction is function f (x0 , x1 , . . . , xn ) in
cuits the following form:
Instead of direct evaluation of E1,x (A) for x ∈ R, a1
x ≥ 0 various approximations are often used. The f (x0 , x1 , . . .) = b0 + , (15)
most popular is probably the following one. a2
b1 +
a3
b2 +
3.1 Rapp’s approximation ...
which is sometimes written as
Y.Rapp published in [3] approximation based on
the equality of E1,x (A) and its first derivative with a1 a a
the approximating function and its first derivative f (x0 , x1 , . . .) = b0 ++ 2 +...+ n +...,
b1 b2 bn
in the points x = 0 and x = 1: (16)
where ai and bi are functions of the real or com-
E1,x (A) ≈ C0 + C1 x + C2 x2 , (10) plex variable xi . Limited expansion into the conti-
nued fraction with n terms is function
C0 = 1, (11) a1 a a
A+2 fn (x0 , x1 , . . . , xp ) = b0 ++ 2 +...+ n .
b1 b2 bn
C1 = − , (12)
(1 + A)2 + A (17)
1 It is possible to evaluate fn directly from the end of
C2 = . (13) the continued fraction. Unfortunately, this method
(1 + A)[(1 + A)2 + A]
is suitable only when the number of the expansion number of terms of the expansion rather than direct
terms is already known. Otherwise a recurrent for- expansion of Fn (A, x). According to Lévy-Soussane
mula suggested by J.Wallis in 1655 could be used:
1 1
pn E1,x (A) = lim ∼ . (23)
fn = , (18) n→∞ Pn (A, x) In (A, x)
qn
It is possible to derive
pn = bn pn−1 + an pn−2 , (19) A x
qn = bn qn−1 + an qn−2 , Pn (A, x) = + + (24)
A−x A−x+2
p−1 = 1, p0 = b0 , q−1 = 0, q0 = 1. 2(x − 1) (n − 1)(x − n + 2)
+ +···+ ,
A−x+4 A − x + 2n − 2
3.3.2 Expansion of incomplete gamma
function x x−1
In (A, x) = 1 + + + (25)
A−x+1 A−x+3
Incomplete gamma function is defined by the
equation 2(x − 2) (n − 1)(x − n + 1)
+ +···+ .
Z ∞ A−x+5 A − x + 2n − 1
Γ(a, x) = e−t ta−1 dt, (20)
x 3.3.3 Evaluation of In (A, x) and Pn (A, x)
where Re(a) > 0 and Re(x) > 0. It is possible to In [2] Lévy-Sousanne is only concerned with the
express E1,x (A) as evaluation of continued fraction backwards from
the term bn . He comments on the usage of the
Ax e−A equation (19): „. . . stability is not guaranteed and
E1,x (A) = . (21)
Γ(1 + x, A) the result obtained is the ratio of two almost-equal
large numbers, which is not acceptable in numeri-
Incomplete gamma function could be expanded into
cal analysisÿ. As it has been stated above, it is ne-
continued fraction:
cessary to repeat the evaluation from the n–th term
Γ(1 + x, A) = (22) for increasing n until reaching the desired accuracy.
Obviously, this is a rather tedious procedure which
 1 −x 1 1−x 2  compensates the advantage of rapid convergence of
= e−A Ax + + + + + . . . , the functions I a P . However, the algorithm (19)
1 A 1 A 1 n n
was improved into the form of the modified Lentz’s
where
method [5]. Instead of using pn and qn temporary
a = −x + n − 1, b = A, variables un and vn are used
2n 2n
a2n+1 = n, b2n+1 = 1, pn qn−1
un = , vn = (26)
a1 = 1, b0 = 0. pn−1 qn

Above mentioned expansion into continued fraction and the resulting function is
is converging for all A > 0 and x > 0 (both condi-
fn = fn−1 un vn , (27)
tions are valid for the real systems). Nevertheless,
the convergence for x > A is slow, and therefore, it where
is often time-consuming to obtain a result with an
appropriate accuracy. In these cases, it is advisa- f0 = b0 , u0 = f0 = b0 , v0 = 0. (28)
ble to evaluate E1,A−1+θ (A), where θ is fractional
part of x. The final value of the loss probability is pn pn−2 an
un = = bn + an = bn + , (29)
evaluated with the recurrent equation (3) or (4). pn−1 pn−1 un−1
To achieve a desired accuracy it is advisable to  an−2 −1
evaluate separately expansion for even and odd vn = bn + a n = (bn + an vn−1 )−1 . (30)
an−1
A problem may occur if the denominator in the 4 Conclusion
evaluation of un or vn equals to zero. Thompson
and Barnett suggested a slight modification of the The aim of this article is to sum up the me-
algorithm to address this issue. If un−1 = 0 or thods of evaluation of the Erlang-B formula. In ad-
bn + an vn−1 = 0 during the evaluation, it is substi- dition to known approaches, usage of Lentz’s algori-
tuted for a small constant, e.g. 10−30 . Lentz’s algo- thm for evaluation of the expansion into continued
rithm could be symbolically written for the desired fraction was suggested. The usage of the expansion
accuracy  as follows: of incomplete-gamma function brings, in contrast
to the Rapp approximation, feasibility to meet the
predefined accuracy. This advantage is compensa-
1 tiny ← 10−30 , ted by higher complexity of the algorithm, which
2 f0 ← b0 , results in slower evaluation for small numbers of
3 if b0 = 0, then f0 ← tiny, circuits, as it was proved by testing on real imple-
4 u0 ← f 0 , mentations. On the testing system , the optimized
5 v0 ← 0, version of Rapp’s approximation was faster than
6 ∆j ← , evaluation of the expansion of incomplete gamma
7 while |∆j − 1| < , do: function up to approx. 1500 circuits (B=0.01). The-
8 vj ← bj + aj vj−1 , refore, Rapp’s approximation is probably the most
9 if vj = 0, then vj ← tiny, suitable for common cases, as far as the evaluation
10 uj ← bj + aj /uj−1 , time. Apart from that, some improvements leading
11 if uj = 0, then uj ← tiny, to fastening the evaluation of the recurrent formula
12 vj ← 1/vj , (3) have been suggested.
13 ∆ j ← uj vj ,
14 fj ← fj−1 ∆j .
Reference
From the practical point of view, it is advisable
to evaluate Pn (A, x) and In (A, x) simultaneously, [1] ITC; ITU-D SG2. Teletraffic en-
as it is possible to exploit the similarity of the ex- gineering handbook. Available at
pansion terms, (see (24),(25)) and thus accelerate <http://www.tele.dtu.dk/teletraffic>.
the algorithm.
[2] Lévy-Soussan, Guy. Numerical Evaluation of
the Erlang Function through a Continued-
3.4 Comparison of the evaluation Fraction Algorithm. Electrical Communi-
time cation, 1968, vol.43, no.2, p.163–168.
To discover the practical suitability of the algo- [3] Rapp, Yngve. Planning of Junction Network in
rithms, their speed has been examined. Table 2 a Multi–exchange Area. II Extensions of the
shows the results for both Rapp’s approximation Principles and Applications. Ericsson Tech-
(tr and tropt ) and the expansion of incomplete ga- nics, 1965, no.2, p.187–240.
mma function into continued fraction (tc and tcopt ,
accuracy 1.10−5 , B=0.01) both for direct and opti- [4] Szybicky, Edmund.Some Numerical Methods
mized implementation: Used for Telephone Traffic Theory Applicati-
ons. Ericsson Technics, 1964, no.2, p.203-229.

n 30 60 90 120 480 1890 [5] Numerical Recipes in C: The Art of Scientific


tr [µs] 4.6 8.8 13.0 17.2 67.9 266.3 Computing, Cambridge University Press, 1992.
tropt [µs] 0.6 0.9 1.2 1.5 5.2 19.5 Available at <http://www.nr.com>.
tc [µs] 5.4 7.0 7.9 8.5 12.4 16.3 [6] Using the RDTSC Instrucion for Per-
tcopt [µs] 3.3 4.1 5.2 5.8 11.6 28.8 formance Monitoring, Intel Corporation,
Table 2: Comparison of the times spent on 1997. Available at <http://cedar.intel.com/
evaluation of the Erlang-B formula using various software/idap/media/pdf/rdtscpm1.pdf>.
implementations.

You might also like