Search⌘ K
AI Features

Polynomial Fitting

Explore how to model scientific data using polynomial fitting with Python's NumPy library. Learn to apply polyfit to find polynomial coefficients, use root mean square error to evaluate fit quality, and understand the balance between polynomial order and model complexity for accurate data representation.

In various scientific fields, we often have data that we need to model using a mathematical equation. This is also called curve fitting, and when the mathematical equation of the model is a polynomial, we call it polynomial fitting.

Root mean square error

One way to quantify the fit between data and a model is to compute the root mean square error. This error is defined as the difference between the observed value and the modeled value. The term ‘error’ is also sometimes known as residual. If the error of data point ii is written as εi\varepsilon_{i}, and the total number of observations is NN, then the sum of squared errors SS is:

S=εi2S=\sum\varepsilon_{i}^2 ...