Thursday, November 20, 2025
HomeLanguagessympy.stats.MultivariateEwens() function in Python

sympy.stats.MultivariateEwens() function in Python

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




# import sympy, MultivariateEwens, density, Symbol
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)
  
# using sympy.stats.MultivariateEwens() method
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




# import sympy, MultivariateEwens, density, Symbol
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)
  
# using sympy.stats.MultivariateEwens() method
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    
\                                
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32404 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6776 POSTS0 COMMENTS
Nicole Veronica
11925 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11994 POSTS0 COMMENTS
Shaida Kate Naidoo
6905 POSTS0 COMMENTS
Ted Musemwa
7160 POSTS0 COMMENTS
Thapelo Manthata
6861 POSTS0 COMMENTS
Umr Jansen
6846 POSTS0 COMMENTS