Erlang_1,k

This notebook computes the CDF of an Erlang_1,k distribution


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

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


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-93bcaec81069> in <module>()
----> 1 pdf = p * mu * exp(-mu*t)

/home/jules/ipython-notebooks/env/lib/python2.7/site-packages/mpmath/ctx_mp_python.pyc in f(x, **kwargs)
    982         def f(x, **kwargs):
    983             if type(x) not in ctx.types:
--> 984                 x = ctx.convert(x)
    985             prec, rounding = ctx._prec_rounding
    986             if kwargs:

/home/jules/ipython-notebooks/env/lib/python2.7/site-packages/mpmath/ctx_mp_python.pyc in convert(ctx, x, strings)
    660         if hasattr(x, '_mpmath_'):
    661             return ctx.convert(x._mpmath_(prec, rounding))
--> 662         return ctx._convert_fallback(x, strings)
    663 
    664     def isnan(ctx, x):

/home/jules/ipython-notebooks/env/lib/python2.7/site-packages/mpmath/ctx_mp.pyc in _convert_fallback(ctx, x, strings)
    612             else:
    613                 raise ValueError("can only create mpf from zero-width interval")
--> 614         raise TypeError("cannot create mpf from " + repr(x))
    615 
    616     def mpmathify(ctx, *args, **kwargs):

TypeError: cannot create mpf from -mu*t

In [ ]: