Open In App

sympy.stats.Reciprocal() in Python

Improve
Improve
Like Article
Like
Save
Share
Report

With the help of sympy.stats.Reciprocal() method, we can get the continuous random variable which represents the Reciprocal distribution.

Syntax : sympy.stats.Reciprocal(name, a, b)
Where, a and b are real number and a, b > 0.

Return : Return the continuous random variable.

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




# Import sympy and Reciprocal
from sympy.stats import Reciprocal, density
from sympy import Symbol, pprint
  
z = Symbol("z")
a = Symbol("a", positive = True)
b = Symbol("b", positive = True)
  
# Using sympy.stats.Reciprocal() method
X = Reciprocal("x", a, b)
gfg = density(X)(z)
  
print(gfg)


Output :

1/(x*(-log(a) + log(b)))

Example #2 :




# Import sympy and Reciprocal
from sympy.stats import Reciprocal, density
from sympy import Symbol, pprint
  
z = 0.35
a = 1
b = 2
  
# Using sympy.stats.Reciprocal() method
X = Reciprocal("x", a, b)
gfg = density(X)(z)
  
print(gfg)


Output :

0.0861703622690834



Last Updated : 08 Jun, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads