bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / stats / _distribution_infrastructure / abs
function
scipy.stats._distribution_infrastructure:abs
source: build-install/usr/lib/python3.14/site-packages/scipy/stats/_distribution_infrastructure.py:5692
Signature
def abs(X, /)Summary
Absolute value of a random variable.
Parameters
X: `ContinuousDistribution`The random variable .
Returns
Y: `ContinuousDistribution`A random variable .
Examples
Suppose we have a normally distributed random variable :math:`X`:import numpy as np from scipy import stats X = stats.Normal()✓
Y = stats.abs(X)
✓import matplotlib.pyplot as plt x = np.linspace(0, 5, 300) ax = plt.gca()✓
Y.plot(x='x', y='pdf', t=('x', -1, 5), ax=ax) plt.plot(x, 2 * X.pdf(x), '--') plt.legend(('PDF of `Y`', 'Doubled PDF of `X`'))✗
<matplotlib.legend.Legend object at 0x7f3f590a0c20>
plt.show()
✓
Aliases
scipy.stats.abs