Let's express some well-known formulas for service waiting time, for which telephone calls are a commonly-used example. Discussion here is based on a web page [1] which states the formulas. I'll just copy the formulas verbatim and show how Maxima can carry out some interesting operations with them. I've posted the script "erlang.mac" which contains the function definitions. [2]
[1] The Erlang-C Formula
[2] erlang.mac
As with other articles about worked examples, I'm including only the barest outline and omitting a lot of details. If you're interested, we can follow up in the comments.
Preliminaries
The erlang.mac script makes use of a couple of Maxima add-ons, namely "namespaces" and "ezunits". It puts the functions it defines in a namespace "erlang" so I'll write "erlang|E_c" to refer to the function E_c in the namespace erlang. Also, the script assumes that quantities (e.g., time) come with units attached.
Numerical examples
Let's reproduce the examples from the web page. First let's compute E_c for a given lambda, T_s, and m.
⇒ |
Let's evaluate T_w, the expected waiting time, for given parameters.
⇒ |
Let's compute the probability that waiting time is less than or equal to 15 seconds.
⇒ |
Symbolic operations
So far, so good; the numerical values agree with those stated on the web page. Let's look at some symbolic operations. If some parameters are unknown, the functions return expressions in the unknown parameters. Given fixed values for call intensity and number of agents, how does expected waiting time vary as a function of the average call duration?
⇒ |
Notice that T_w is undefined for (number of agents)/(call intensity) ≥ 1. As that ratio approaches 1 from below, the expected waiting time increases without bound.
Likewise, the function P(waiting time ≤ t) is a function of t alone given other parameters.
⇒ |
Let's construct a function which takes just t as an argument. The other parameters are baked in.
⇒ |
Let's take a look at that function W.
Another way to approach this is to construct a lambda expression (anonymous function).
⇒ |
⇒ |
⇒ |
Finally, let's construct a memoizing function (called an "array function" in Maxima). We can think of this as a family of functions of t which are indexed by the parameters.
⇒ |
⇒ |
⇒ |
That's it for now.
⇒ |
This comment has been removed by a blog administrator.
ReplyDelete