Monday, July 27, 2026
HomeLanguagessympy.stats.Rademacher() function in Python

sympy.stats.Rademacher() function in Python

The Rademacher distribution is distribution of discrete probability when a random variable has a half probability of being +1 and half probability of being -1. With the help of sympy.stats.Rademacher() method, we can create the random variable having randemacher distribution by using sympy.stats.Rademacher() method.

Syntax : sympy.stats.Rademacher(name)

Return : Return the rademacher distribution.

Example #1 :
In this example, we can see that by using sympy.stats.Rademacher() method, we are able to get the random variable of Rademacher distribution by using this method.




# Import sympy and Rademacher
from sympy.stats import Rademacher, density
  
  
# Using sympy.stats.Rademacher() method
X = Rademacher('X')
gfg = density(X).dict
  
print(gfg)


Output :

{1: 1/2, -1: 1/2}

Example #2 :




# Import sympy and Rademacher
from sympy.stats import Rademacher, density, P
  
  
# Using sympy.stats.Rademacher() method
X = Rademacher('X')
gfg = density(X).dict
  
print(P(gfg >= 0))


Output :

1/2
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

6 COMMENTS

Most Popular

Dominic
32520 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6903 POSTS0 COMMENTS
Nicole Veronica
12017 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12115 POSTS0 COMMENTS
Shaida Kate Naidoo
7023 POSTS0 COMMENTS
Ted Musemwa
7265 POSTS0 COMMENTS
Thapelo Manthata
6980 POSTS0 COMMENTS
Umr Jansen
6972 POSTS0 COMMENTS