With the help of sympy.stats.Logarithmic() method, we can get the random variable representing the logarithmic distribution.
Syntax :
sympy.stats.Logarithmic(name, p)
Return : Return the random variable.
Example #1 :
In this example we can see that by using sympy.stats.Logarithmic() method, we are able to get the random variable representing the logarithmic distribution by using this method.
# Import sympy and logarithmic from sympy.stats import Logarithmic, density, E, variance from sympy import Symbol, S Â Â p = S.One / 5Â Â # Using sympy.stats.Logarithmic() method X = Logarithmic("x", p) gfg = density(X)(3) Â Â print(gfg) |
Output :
-1/(375*log(4/5))
Example #2 :
# Import sympy and logarithmic from sympy.stats import Logarithmic, density, E, variance from sympy import Symbol, S Â Â p = 0.46Â Â # Using sympy.stats.Logarithmic() method X = Logarithmic("x", p) gfg = density(X)(4) Â Â print(gfg) |
Output :
0.0181660042052665

