How this calculation works
Construct a positive small Gaussian rule from a finite moment sequence and check polynomial reproduction.
sum_i w_i x_i^k=μ_k for k=0,…,2n−1.A worked example
Uniform weight on[−1,1],n=3 yields nodes0,±sqrt(3/5) and weights8/9,5/9,5/9.
Good to know
2–6 nodes,moments μ0…μ2n,positive Hankel matrices and finite values;Cholesky/symmetric eigensystem,moment residual check. No arbitrary-integrand error bound or proof of an infinite moment measure.
Moments can define a custom quadrature rule
Gaussian quadrature chooses nodes and weights so a weighted integral is reproduced for every polynomial through a specified degree. This page starts from supplied moments of the weight functional rather than choosing a fixed named weight such as the Legendre family. It constructs a small rule from that moment information.
For n nodes,the target exactness is through degree2n−1. The interface also requests moment2n to check an enlarged positivity condition. Those conditions support the bounded construction,but the page does not establish a unique underlying probability distribution or an infinite moment sequence from finitely many numbers.
Compare this with the Gauss–Legendre quadrature calculator with nodes and weights. Construct nodes and weights for an entered positive moment functional,not only a fixed Legendre weight.
Enter consecutive moments in order
Supply μ0,μ1 and every subsequent moment through μ2n,with no skipped powers. The zeroth moment is total measure mass and must be positive;it need not equal one. The supported rule has two through six nodes and uses finite real moment values within the input bounds.
Units and scaling matter because high moments can vary across many orders of magnitude. A moment sequence from a small spatial interval can be much better conditioned after rescaling. The page does not infer that transformation or repair a rounded sequence that no longer satisfies its numerical positivity tests.
Hankel positivity supplies the inner product
The moment Hankel matrix has entries μ(i+j),representing inner products between monomials. Positive definiteness makes the polynomial inner product nondegenerate over the required degree range. The implementation checks both the enlarged Hankel matrix and the factor used for the construction.
A nonpositive or nearly singular matrix is rejected rather than assigned negative quadrature weights or complex nodes. Such a rejection may reflect invalid moments,finite support with insufficient rank,or numerical conditioning. It does not by itself distinguish those mathematical and rounding causes.
Turn multiplication into an eigenproblem
The shifted moment matrix represents multiplication by the integration variable. Cholesky factors transform the generalized problem into a symmetric matrix,whose eigenvalues become the nodes. Squared components of its normalized eigenvectors,scaled by μ0,give the positive weights under the chosen basis convention.
This is a numerical linear-algebra construction rather than a symbolic root formula. It does not require a user to provide orthogonal-polynomial recurrence coefficients separately. Symmetry and positive-definite checks make the relation between moments,nodes and weights inspectable instead of hiding an unexplained lookup table.
Recover the three-node Legendre example
For unit weight on[−1,1],odd moments vanish and μ(2j)=2/(2j+1). Entering those values through μ6 with n=3 returns nodes approximately−0.7745966692,zero and0.7745966692. The weights are5/9,8/9 and5/9.
The weights sum to two,which matches the interval's total mass. Their weighted squared nodes sum to2/3,and the weighted fourth powers sum to2/5. These are separate moment checks,not merely a visual symmetry check of the returned nodes about the origin.
Check polynomial exactness and conditioning
The calculator evaluates every reconstructed moment from degree zero through2n−1 and reports the largest discrepancy. Passing that residual check confirms the computed rule's agreement with the entered finite moments at the stated numerical tolerance. It does not bound the error for an arbitrary nonpolynomial integrand.
An integration error theorem would require additional information about the true weight support and regularity or derivatives of the function being integrated. The moment-only interface does not supply those facts. Avoid presenting its exactness residual as a universal integration-error certificate.
Use custom rules without changing their meaning
The output nodes and weights can be applied to polynomial or smooth-function evaluations using the same measure and coordinate scale that defined the moments. If moments came from normalized probabilities,the weights sum to one;if they came from an unnormalized measure,their sum reproduces that mass instead.
The implementation excludes indefinite moment functionals,complex weights and arbitrary-order symbolic construction. Near a rank boundary,the finite checks may reject an otherwise meaningful limiting rule. Retain the full entered moment sequence,node count,residual and scaling convention when comparing the result with another quadrature routine.
A few questions, answered
Must μ0 equal one?
No. It is the total measure mass and weights sum to it.
Why supply μ2n?
It supports the enlarged Hankel positivity check even though exactness is through2n−1.
Are negative weights accepted?
The construction requires positive-definite moment data and produces positive weights.
Does the moment residual bound every integral error?
No. It checks the supplied polynomial moments only.