openmc.stats.Legendre

class openmc.stats.Legendre(coefficients: Sequence[float])[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.

Variables

coefficients (Iterable of Real) – Expansion coefficients \(a_\ell\). Note that the \((2\ell + 1)/2\) factor should not be included.

sample(n_samples=1, seed=None)[source]

Sample the univariate distribution

Parameters
  • n_samples (int) – Number of sampled values to generate

  • seed (int or None) – Initial random number seed.

Returns

A 1-D array of sampled values

Return type

numpy.ndarray