Change language

# scipy.stats.expon () | python

scipy.stats.expon () — an exponential continuous random variable that is defined by a standard format and some form parameters to complete its specification.

Parameters:
q: lower and upper tail probability
x: quantiles
loc: [optional] location parameter. Default = 0
scale: [optional] scale parameter. Default = 1
size: [tuple of ints, optional] shape or random variates.
moments: [optional] composed of letters [’mvsk ’]; ’m’ = mean, ’v’ = variance, ’s’ = Fisher’s skew and ’k’ = Fisher’s kurtosis. (default = ’mv’).

Results: exponential continuous random variable

Code # 1: Generating an exponential continuous random variable values ​​

 ` from ` ` scipy.stats ` ` import ` ` expon `   ` numargs ` ` = ` ` expon.numargs ` ` [] ` ` = ` ` [ ` ` 0.6 ` `,] ` ` * ` ` numargs ` ` rv ` ` = ` ` expon ( ) ` ` `  ` print ` ` (` `" RV: "` `, rv) `

Output:

` RV: "scipy.stats._distn_infrastructure.rv_frozen object at 0x0000018D56531CC0" `

Code # 2: Exponential Random Variables and Probability Distribution.

 ` import ` ` numpy as np ` ` quantile ` ` = ` ` np.arange (` ` 0.01 ` `, ` ` 1 ` `, ` ` 0.1 ` `) `   ` # Random Variants ` ` R ` ` = ` ` expon.rvs (scale ` ` = ` ` 2 ` `, size ` ` = ` ` 10 ` `) ` ` pr int ` ` (` ` "Random Variates:" ` `, R) `   ` # PDF ` ` R ` ` = ` ` expon.pdf (quantile, loc ` ` = ` ` 0 ` `, scale ` ` = ` ` 1 ` `) ` ` print ` ` (` ` "Probability Distribution:" ` `, R) `

Output:

` Random Variates: [2.50259466e-04 4.32311862e + 00 8.22833503e-01 1.63374263e + 00 4.46784023e + 00 3.56781485e + 00 3.95381396e + 00 1.17623772e + 00 3.21834266e-02 4.14778445e + 00] Probability Distribution: [0.99004983 0.89583414 0.81058425 0.73344696 0.6636 5025 0.60049558 0.54335087 0.4916442 0.44485807 0.40252422] `

Code # 3: Graphic representation.

` `

` import numpy as np import matplotlib.pyplot as plt   distribution = np.linspace ( 0 , np.minimum (rv. dist.b, 5 )) print ( "Distribution:" , distribution)   plot = pl t.plot (distribution, rv.pdf (distribution)) `

Output:

` Distribution: [0. 0.10204082 0.20408163 0.30612245 0.40816327 0.51020408 0.6122449 0.71428571 0.81632653 0.91836735 1.02040816 1.12244898 1.2244898 1.32653061 1.42857143 1.53061224 1.63265306 1.73469388 1.83673469 1.93877551 2.04081633 2.14285714 2.24489796 2.34693878 2.44897959 2.55102041 2.65306122 2.75510204 2.85714286 2.95918367 3.06122449 3.16326531 3.26530612 3.36734694 3.46938776 3.57142857 3.67346939 3.7755102 3.87755102 3.97959184 4.08163265 4.18367347 4.28571429 4.3877551 4.48979592 4.59183673 4.69387755 4.79591837 4.89795918 5. ] `

Code # 4: Various Positional Arguments

 ` import ` ` matplotlib. pyplot as plt ` ` import ` ` numpy as np `   ` x ` ` = ` ` np.linspace (` ` 0 ` `, ` ` 5 ` `, ` ` 100 ` `) `   ` # Various positional arguments ` ` y1 ` ` = ` ` expon.pdf (x, ` ` 2 ` `, ` ` 6 ` `) ` ` y2 ` ` = ` ` expon.pdf (x, ` ` 1 ` `, ` ` 4 ` `) ` ` plt.plot (x, y1, ` ` "*" , x, y2, "r--" ) `` `

Output:

## Shop

Best laptop for Excel

\$

Best laptop for Solidworks

\$399+

Best laptop for Roblox

\$399+

Best laptop for development

\$499+

Best laptop for Cricut Maker

\$299+

Best laptop for hacking

\$890

Best laptop for Machine Learning

\$699+

Raspberry Pi robot kit

\$150

Latest questions

PythonStackOverflow

Common xlabel/ylabel for matplotlib subplots

PythonStackOverflow

Check if one list is a subset of another in Python

PythonStackOverflow

How to specify multiple return types using type-hints

PythonStackOverflow

Printing words vertically in Python

PythonStackOverflow

Python Extract words from a given string

PythonStackOverflow

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

PythonStackOverflow

Python os.path.join () method

PythonStackOverflow

Flake8: Ignore specific warning for entire file

## Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

How to specify multiple return types using type-hints

Printing words vertically in Python

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries