With the help of sympy.stats.UniformSum()
method, we can get the continuous random variable which represents the irwin-hall distribution.
Syntax :
sympy.stats.UniformSum(name, n)
Where, n is real number.Return : Return the continuous random variable.
Example #1 :
In this example we can see that by using sympy.stats.UniformSum()
method, we are able to get the continuous random variable representing irwin-hall distribution by using this method.
# Import sympy and UniformSum from sympy.stats import UniformSum, density from sympy import Symbol, pprint z = Symbol( "z" ) n = Symbol( "n" , positive = True ) # Using sympy.stats.UniformSum() method X = UniformSum( "x" , n) gfg = density(X)(z) pprint(gfg) |
Output :
floor(z)
___
\ `
\ k n – 1 /n\
) (-1) *(-k + z) *| |
/ \k/
/__,
k = 0
——————————–
(n – 1)!
Example #2 :
# Import sympy and UniformSum from sympy.stats import UniformSum, density from sympy import Symbol, pprint z = 3 n = 5 # Using sympy.stats.UniformSum() method X = UniformSum( "x" , n) gfg = density(X)(z) pprint(gfg) |
Output :
3
___
\ `
\ k 4 /5\
) (-1) *(3 – k) *| |
/ \k/
/__,
k = 0
————————
24