Least-squares polynomial fit calculator

Calculate polynomial coefficients in ascending powers of x and fitted values at sample x coordinates with your own figures.

Your numbers

Use the units shown. Results update as you change valid inputs.

Use polynomial coefficients in ascending powers of x and fitted values at sample x coordinates to compare changes to your inputs. The method and limits below explain the scope.

Examples

Examples

Try the starting example

Samples: x,y, one pair per line
-1,1 0,0 1,1
Polynomial degree, at most 8
2
Positive weight for each sample
1,1,1
Polynomial coefficients in ascending powers of x
0, 0, 1
Fitted values at sample x coordinates
1, 0, 1
Weighted residual sum of squares
0
Condition estimate of scaled weighted design
3.225505

Try another scenario

Samples: x,y, one pair per line
-1,-1 0,1 1,3
Polynomial degree, at most 8
1
Positive weight for each sample
2,1,2
Polynomial coefficients in ascending powers of x
1, 2
Fitted values at sample x coordinates
-1, 1, 3
Weighted residual sum of squares
0
Condition estimate of scaled weighted design
1.118034
Calculation method

Calculation method

Polynomial coefficients in ascending powers of x

Centre and scale x, solve weighted least squares by SVD, then convert coefficients back to ascending powers of original x.

Fitted values at sample x coordinates

Evaluate the stable centred/scaled fit at each sample.

Weighted residual sum of squares

Sum weight_i×(fit_i−observed_i)².

Condition estimate of scaled weighted design

Largest/smallest singular value of the weighted scaled Vandermonde design; reject relative rank below 1e-12.

Symbols and units
a
Samples: x,y, one pair per line
b
Polynomial degree, at most 8
c
Positive weight for each sample

Use the units shown. A list keeps the order in which you enter its values. The symbol ^ means “raised to the power of”.

Assumptions & limits

Assumptions & limits

  • Weighted real least squares for degree 0–8 below the sample count, with positive matched weights. Large coordinate offsets can make the expanded x coefficients ill-conditioned even when the centred fit is stable. No statistical confidence interval is inferred. Double-precision results are approximate. Numeric tables use 12 significant digits and display components at roundoff scale (32 machine epsilons relative to their row or relevant calculation scale) as zero; scalar diagnostics retain full precision.
Are these inputs private?

These calculations run in your browser. A shared link contains the values you choose to share. Only questions submitted to the separate AI finder are sent to OpenAI.

Further reading

ml-matrix: numerical decompositions ↗

Background reading; this does not imply endorsement or independent review of SumFizz.

Share this page
Share this calculator

Leave unchecked to share the page without your entered values.