LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
fj_xmax_hyperexp.h File Reference

Expected maximum of K i.i.d. More...

Include dependency graph for fj_xmax_hyperexp.h:

Go to the source code of this file.

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::fj

Functions

template<class T>
T line::fj::fj_xmax_hyperexp (unsigned K, const T &p1, const T &mu1, const T &mu2)
 Expected maximum of K i.i.d.

Detailed Description

Expected maximum of K i.i.d.

two-phase hyperexponential service times.

Templated port of matlab/src/api/fj/fj_xmax_hyperexp.m.

X_K^max = sum_{n=1..K} C(K,n) (-1)^{n+1} sum_{m=0..n} C(n,m) p1^m p2^{n-m} / (m mu1 + (n-m) mu2)

from the binomial expansion 1 - F(x)^K = sum_n C(K,n) (-1)^{n+1} S(x)^n of the survival S = p1 e^{-mu1 x} + p2 e^{-mu2 x}. The outer C(K,n) was missing in every codebase until 2026-11-14, which returned an alternating partial sum (0.39167 instead of H_5/2 = 1.14167 at mu1 = mu2 = 2, K = 5). Every term is rational, so the sum is exact in the field – which is the point, because it alternates: the terms grow like 2^K while the result stays O(log K/mu), so in double the answer is destroyed by cancellation somewhere around K = 25 and is pure noise by K = 40.

MATLAB, FJ_xmax.fj_xmax_hyperexp in the JAR and the Python twin carry the same formula.

Definition in file fj_xmax_hyperexp.h.