Open In App

sympy.stats.Reciprocal() in Python

Last Updated : 08 Jun, 2020
Comments
Improve
Suggest changes
Like Article
Like
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. Python3 1=1
# 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 : Python3 1=1
# 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

Practice Tags :

Similar Reads