Erlang_1,k

This notebook computes the CDF of an Erlang_1,k distribution


In [22]:
from sympy import *
import mpmath as mp
%matplotlib inline
init_printing()
p, mu, t, k  = symbols('p, mu, t, k')

In [25]:
pdf = p * mu * exp(-mu*t)  + (1 - p)* (mu**k) * ((t**( k - 1))/ factorial(k-1)) *exp(-mu*t)
pdf


Out[25]:
$$\mu p e^{- \mu t} + \frac{\mu^{k} t^{k - 1}}{\left(k - 1\right)!} \left(- p + 1\right) e^{- \mu t}$$

In [30]:
cdf = integrate(pdf,t)

In [31]:
cdf


Out[31]:
$$\frac{k \left(- p + 1\right) \Gamma{\left(k \right)} \gamma\left(k, \mu t\right)}{\left(k - 1\right)! \Gamma{\left(k + 1 \right)}} + \mu p \begin{cases} t & \text{for}\: \mu = 0 \\- \frac{1}{\mu} e^{- \mu t} & \text{otherwise} \end{cases}$$

In [ ]: