How this calculation works
Polynomial chaos expands a response in orthogonal polynomials matched to an input distribution. This calculator projects a one-variable polynomial response onto Legendre or probabilists’ Hermite bases using analytic moments. It returns the retained coefficients, mean, variance and variance omitted by truncating the expansion.
c_k=E[YΨ_k]/E[Ψ_k²]; E[Y]=c0; Var(Y_N)=Σ_(k=1)^N c_k² E[Ψ_k²].A worked example
If X is uniform on [−1,1] and Y=X², then X²=(1/3)P0+(2/3)P2. The mean is 1/3 and variance is (2/3)²×(1/5)=4/45. Retaining only degree one keeps the correct mean but gives zero expansion variance and omits all 4/45.
Good to know
One standardized independent input only: uniform [−1,1] or standard normal. Response degree and expansion order ≤10. Floating-point analytic moments, ordinary Legendre or probabilists’ Hermite normalization. No data fitting, correlated multivariate inputs, distribution inference or nonpolynomial quadrature.
Reference: NumPy — Legendre and Hermite polynomial conventions (opens in a new tab) ↗
Match the basis to the probability measure
Orthogonality is defined using expectation under the selected input distribution. Ordinary Legendre polynomials are orthogonal for the uniform measure on [−1,1], while probabilists’ Hermite polynomials are orthogonal for the standard normal measure. Selecting the other family changes the probability model, not merely the display style of the coefficients.
For a nonstandard physical variable, a separate change of variables is needed before entering the response. For example, a uniform interval [a,b] can be mapped from a standardized input. Substitute that map into the response polynomial first; entering a raw physical polynomial while selecting a standardized distribution silently changes its moments.
The Chebyshev polynomial approximation calculator covers a related task. This page focuses on polynomial chaos expansion calculator for uniform or normal inputs with the method limits and worked example described below.
Basis norms belong in the variance formula
These bases are orthogonal but not normalized to unit squared norm. The result prints each norm alongside its coefficient. Omitting that factor gives the wrong variance even when the expansion coefficients are correct. In the uniform example, the degree-two norm is one fifth, which turns coefficient square 4/9 into variance contribution 4/45.
The constant basis coefficient gives the exact mean for the entered polynomial because every nonconstant orthogonal basis function has zero expectation. Truncating higher degrees can therefore preserve the mean while losing substantial variance. This is why the retained variance and omitted variance are reported separately rather than presenting a low-order expansion as the full distribution.
Analytic moments avoid a Monte Carlo interpretation
The projection uses polynomial products and known moments of the declared distribution. It does not draw random samples, so there is no sampling confidence interval or seed to choose. Floating-point cancellation can still affect very high moments or strongly scaled coefficients; the degree and coefficient limits keep this bounded implementation manageable.
The related Chebyshev approximation calculator targets deterministic function approximation under a different basis and weighting. Polynomial chaos here is explicitly probabilistic: expectation defines the inner product, and coefficient squares weighted by basis norms summarize uncertainty in the selected one-input model.
A few questions, answered
Why does low order underestimate variance?
It omits orthogonal components whose nonnegative variance contributions are printed as omitted variance.
Which Hermite convention is used?
The probabilists’ convention for a standard normal input, not the physicists’ convention.