openmc.stats.Legendre
- class openmc.stats.Legendre(coefficients: Sequence[float], bias: Univariate | None = None)[source]
Probability density given by a Legendre polynomial expansion \(\sum\limits_{\ell=0}^N \frac{2\ell + 1}{2} a_\ell P_\ell(\mu)\).
- Parameters:
coefficients (Iterable of Real) – Expansion coefficients \(a_\ell\). Note that the \((2\ell + 1)/2\) factor should not be included.
bias (openmc.stats.Univariate or None, optional) – Distribution for biased sampling.
- Variables:
coefficients (Iterable of Real) – Expansion coefficients \(a_\ell\). Note that the \((2\ell + 1)/2\) factor should not be included.
support (tuple of float) – A 2-tuple (lower, upper) defining the interval over which the distribution is nonzero-valued
bias (openmc.stats.Univariate or None) – Distribution for biased sampling
- evaluate(x)[source]
Evaluate the probability density at the provided value.
- Parameters:
- Returns:
Value of p(x)
- Return type:
- sample(n_samples=1, seed=None)[source]
Sample the univariate distribution, handling biasing automatically.
- Parameters:
- Returns:
A tuple of (samples, weights)
- Return type:
- property support
Return the support of the probability distribution.