The website of James Shaw, a postdoctoral researcher at The University of Sheffield developing mathematical methods for flood simulators

Interactive polynomial fit visualisation

3 May 2016

This demonstration shows quadratic and cubic polynomials fitted through a set of points using a least squares approach. This technique generalises to higher dimensions and can be used as an interpolation function for solving the flux form advection equation on arbitrary meshes.

Drag points to change the fit. Control-drag points to change weights. The polynomial is fitted almost exactly through the filled points (which have large weights) and inexactly through the open points (which have small weights).

Coefficients are displayed next to each point with a colour corresponding to the quadratic and cubic curves. These coefficients are multiplied by the \(y\)-values at each point to calculate the interpolated value where the curve intersects the \(y\)-axis.

Created with d3js and numericjs. The source repository is available on GitHub.