sympy.stats.MultivariateEwens() function in Python
Last Updated :
18 Aug, 2020
With the help of sympy.stats.MultivariateEwens() method, we can create a discrete random variable with Multivariate Ewens Distribution.
Syntax: sympy.stats.MultivariateEwens(syms, n, theta)
Parameters:
syms: the symbol
n: size of the sample or the integer whose partitions are considered, a positive integer
theta: mutation rate, must be positive real number
Returns: a discrete random variable with Multivariate Ewens Distribution.
Example #1 :
Python3
from sympy.stats.joint_rv_types import MultivariateEwens
from sympy.stats import density
from sympy import Symbol, pprint
a = Symbol( 'a' , positive = True )
b = Symbol( 'b' , positive = True )
E = MultivariateEwens( 'E' , 2 , 1 )
mveDist = density(E)(a, b)
pprint(mveDist)
|
Output :
/ -a2
| 2
|------- for a1 + 2*a2 = 2
<a1!*a2!
|
| 0 otherwise
\
Example #2 :
Python3
from sympy.stats.joint_rv_types import MultivariateEwens
from sympy.stats import density
from sympy import Symbol, pprint
a = Symbol( 'a' , positive = True )
b = Symbol( 'b' , positive = True )
E = MultivariateEwens( 'E' , 2 , 1 / 2 )
mveDist = density(E)(a, b)
pprint(mveDist)
|
Output :
/ -a1 -2*a2
|8*2 *2
|------------- for a1 + 2*a2 = 2
< 3*a1!*a2!
|
| 0 otherwise
\
Share your thoughts in the comments
Please Login to comment...