Related Articles
sympy.stats.Laplace() in python
• Last Updated : 05 Jun, 2020

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

Syntax : `sympy.stats.Laplace(name, mu, b)`
Where, mu and b are real number and mu, b > 0.
Return : Return the continuous random variable.

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

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

Output :

-|mu – z|
———-
b
e
———–
2*b

Example #2 :

 `# Import sympy and Laplace``from` `sympy.stats ``import` `Laplace, density``from` `sympy ``import` `Symbol, pprint`` ` `z ``=` `0.6``mu ``=` `2``b ``=` `2.5`` ` `# Using sympy.stats.Laplace() method``X ``=` `Laplace(``"x"``, mu, b)``gfg ``=` `density(X)(z)`` ` `pprint(gfg)`

Output :

0.114241812769763

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up