With the help of sympy.stats.Erlang()
method, we can get the continuous random variable representing the erlang distribution.
Syntax :
sympy.stats.Erlang(name, k, l)
Where, k is the positive integer and l is a real number greater than 0.
Return : Return continuous random variable.
Example #1 :
In this example we can see that by using sympy.stats.Erlang()
method, we are able to get the continuous random variable which represents the Erlang distribution by using this method.
# Import sympy and Erlang from sympy.stats import Erlang, density
from sympy import Symbol
k = Symbol( "k" , integer = True , positive = True )
l = Symbol( "l" , integer = True , positive = True )
z = Symbol( "z" )
# Using sympy.stats.Erlang() method X = Erlang( "x" , k, l)
gfg = density(X)(z)
pprint(gfg) |
Output :
k k – 1 -l*z
l *z *e
—————
Gamma(k)
Example #2 :
# Import sympy and Erlang from sympy.stats import Erlang, density
from sympy import Symbol
k = 2
l = 3
z = 1
# Using sympy.stats.Erlang() method X = Erlang( "x" , k, l)
gfg = density(X)(z)
pprint(gfg) |
Output :
-3
9*e