Open In App

sympy.stats.Exponential() in python

Last Updated : 05 Jun, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
With the help of sympy.stats.Exponential() method, we can get the continuous random variable representing the exponential distribution.
Syntax : sympy.stats.Exponential(name, rate) Return : Return continuous random variable.
Example #1 : In this example we can see that by using sympy.stats.Exponential() method, we are able to get the continuous random variable which represents the Exponential distribution by using this method. Python3 1=1
# Import sympy and Exponential
from sympy.stats import Exponential, density
from sympy import Symbol

rate = Symbol("rate", integer = True, positive = True)
z = Symbol("z")

# Using sympy.stats.Exponential() method
X = Exponential("x", rate)
gfg = density(X)(z)

pprint(gfg)
Output :
-rate*z rate*e
Example #2 : Python3 1=1
# Import sympy and Exponential
from sympy.stats import Exponential, density
from sympy import Symbol

rate = 5
z = 0.5

# Using sympy.stats.Exponential() method
X = Exponential("x", rate)
gfg = density(X)(z)

pprint(gfg)
Output :
0.410424993119494

Practice Tags :

Similar Reads