# scipy 1.18.1 (BSD-3-Clause), harvested by tools/harvest_corpus.py
=== input
Natural exponential of a random variable.

    Parameters
    ----------
    X : `ContinuousDistribution`
        The random variable :math:`X`.

    Returns
    -------
    Y : `ContinuousDistribution`
        A random variable :math:`Y = \exp(X)`.

    Examples
    --------
    Suppose we have a normally distributed random variable :math:`X`:

    >>> import numpy as np
    >>> from scipy import stats
    >>> X = stats.Normal()

    We wish to have a lognormally distributed random variable :math:`Y`,
    a random variable whose natural logarithm is :math:`X`.
    If :math:`X` is to be the natural logarithm of :math:`Y`, then we
    must take :math:`Y` to be the natural exponential of :math:`X`.

    >>> Y = stats.exp(X)

    To demonstrate that ``X`` represents the logarithm of ``Y``,
    we plot a normalized histogram of the logarithm of observations of
    ``Y`` against the PDF underlying ``X``.

    >>> import matplotlib.pyplot as plt
    >>> rng = np.random.default_rng(435383595582522)
    >>> y = Y.sample(shape=10000, rng=rng)
    >>> ax = plt.gca()
    >>> ax.hist(np.log(y), bins=50, density=True)
    >>> X.plot(ax=ax)
    >>> plt.legend(('PDF of `X`', 'histogram of `log(y)`'))
    >>> plt.show()

    
=== parse numpydoc
short_description: 'Natural exponential of a random variable.'
blank_after_short_description: True
blank_after_long_description: False
style: numpydoc
- DocstringParam
  description: 'The random variable :math:`X`.'
  kind: param
  key: 'param'
  arg_name: 'X'
  type_name: '`ContinuousDistribution`'
  is_optional: False
- DocstringReturns
  description: 'A random variable :math:`Y = \\exp(X)`.'
  kind: returns
  key: 'returns'
  type_name: '`ContinuousDistribution`'
  is_generator: False
  return_name: 'Y'
- DocstringExample
  description: 'Suppose we have a normally distributed random variable :math:`X`:'
  kind: examples
  key: 'examples'
  snippet: '>>> import numpy as np'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> from scipy import stats'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> X = stats.Normal()'
- DocstringExample
  description: |
    We wish to have a lognormally distributed random variable :math:`Y`,
    a random variable whose natural logarithm is :math:`X`.
    If :math:`X` is to be the natural logarithm of :math:`Y`, then we
    must take :math:`Y` to be the natural exponential of :math:`X`.
  kind: examples
  key: 'examples'
  snippet: '>>> Y = stats.exp(X)'
- DocstringExample
  description: |
    To demonstrate that ``X`` represents the logarithm of ``Y``,
    we plot a normalized histogram of the logarithm of observations of
    ``Y`` against the PDF underlying ``X``.
  kind: examples
  key: 'examples'
  snippet: '>>> import matplotlib.pyplot as plt'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> rng = np.random.default_rng(435383595582522)'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> y = Y.sample(shape=10000, rng=rng)'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> ax = plt.gca()'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> ax.hist(np.log(y), bins=50, density=True)'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> X.plot(ax=ax)'
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: ">>> plt.legend(('PDF of `X`', 'histogram of `log(y)`'))"
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: '>>> plt.show()'
=== detect
numpydoc
=== compose numpydoc
Natural exponential of a random variable.

Parameters
----------
X : `ContinuousDistribution`
    The random variable :math:`X`.

Returns
-------
Y : `ContinuousDistribution`
    A random variable :math:`Y = \exp(X)`.

Examples
--------
Suppose we have a normally distributed random variable :math:`X`:

>>> import numpy as np
>>> from scipy import stats
>>> X = stats.Normal()

We wish to have a lognormally distributed random variable :math:`Y`,
a random variable whose natural logarithm is :math:`X`.
If :math:`X` is to be the natural logarithm of :math:`Y`, then we
must take :math:`Y` to be the natural exponential of :math:`X`.

>>> Y = stats.exp(X)

To demonstrate that ``X`` represents the logarithm of ``Y``,
we plot a normalized histogram of the logarithm of observations of
``Y`` against the PDF underlying ``X``.

>>> import matplotlib.pyplot as plt
>>> rng = np.random.default_rng(435383595582522)
>>> y = Y.sample(shape=10000, rng=rng)
>>> ax = plt.gca()
>>> ax.hist(np.log(y), bins=50, density=True)
>>> X.plot(ax=ax)
>>> plt.legend(('PDF of `X`', 'histogram of `log(y)`'))
>>> plt.show()
