更新记录
2023.10.26:在线多项式曲线及曲线函数拟合工具完成上线

Online Polynomial Curve and Curve Function Fitting Tool

This is an online tool website that can fit polynomial curves and corresponding curve functions based on the echarts plugin. Users can enter coordinate points in the input box, and the corresponding coordinate system curve (or straight line) fitting shape will be drawn in the Cartesian coordinate system below, and the corresponding fitting curve function of the shape will be provided at the same time. It is provided for free for friends who need it for reference.


  1. Enter multiple sets of coordinates (x, y) values, and you can calculate the polynomial fitting function expression for this group of data based on these coordinate points, and draw the corresponding fitting curve shape.
  2. Enter the fitting points below, one point per line, for example: 520 13.14, separate the numbers with "," (English comma).
The function equation expression is:

JavaScriptThe Implementation Method of Polynomial Function Fitting

Often encounter situations where you are given a few points and asked to find patterns or the like. Polynomial functions are a very important modeling tool. Using any number of points, you can fit a polynomial function. By using the polynomial function to derive the function values of other points, and then drawing the function curve, this is the most basic principle, very simple!
  • First, Fit through points to obtain the functional relationship of the fitted polynomial (a JavaScript method), during the fitting process, record the intermediate generated two-dimensional array, used for subsequent calculation of chart values;
  • Second, Convert the obtained set relationship into the expression of the polynomial function, such as x*x*x + a*x*x + b*x +c;
  • Third, Calculate the maximum and minimum values of x among the given fitting points, calculate the gap = max - min, and then take the range (min - 0.3 * gap, max + 0.3 * gap) as the x-axis range for drawing the chart;
  • Fourth, Set the number of chart drawing points to 1000, then take 1000 equidistant x values in the range (min - 0.3 * gap, max + 0.3 * gap), calculate the corresponding y values through the function, and then get x_data_array, y_data_array;
  • Fifth, With 1000 data points for x and y axes, you can use echarts to draw the function, line chart smooth curve, and then see the polynomial function curve;
For the source code of echarts, please click here .

About Polynomial Function F(x)

  1. A function of the form Pn(x)= anx^n+ an-1x^(n-1)+…+ a1x+ a0 is called a polynomial function. It is obtained by a finite number of multiplications and additions of constants and the independent variable x. Clearly, when n=1, it is a linear function y=kx+b, and when n=2, it is a quadratic function y=ax^2+bx+c.
  2. A function of the form y=kx+b (k is any non-zero constant, b is any constant) is called a linear function. Its image can be represented by a straight line in the plane Cartesian coordinate system. When the value of one variable in the linear function is determined, the value of another variable can be determined by a linear equation.
  3. Generally, a function of the form y=ax^2+bx+c is called a quadratic function. A quadratic function is a polynomial function with the highest degree of the independent variable being two. Its image is a parabola in the plane Cartesian coordinate system.
  4. A function of the form y=ax^3+bx^2+cx+d (a≠0, b, c, d are constants) is called a cubic function. The image of a cubic function is a curve - a parabolic regression line (different from a normal parabola), which has relatively special properties.
  5. For the given multiple discrete coordinate points, polynomial functions can generally be used for fitting to analyze their rules; if n coordinate points are given, then a polynomial of degree n-1 can be used for fitting.

Mathematical Function Polynomial Description

  1. An algebraic expression composed of several monomials is called a polynomial (subtraction has: subtracting a number is equal to adding its opposite number). Each monomial in the polynomial is called a term of the polynomial, and the highest degree of these monomials is the degree of the polynomial.
  2. Polynomials are simple continuous functions, they are smooth, and their differentials are also polynomials. The spirit of Taylor's polynomial is to approximate a smooth function with a polynomial. In addition, continuous functions on a closed interval can be uniformly approximated by polynomials.
  3. Polynomials have a very important characteristic, that is, one x value corresponds to one y value, and two identical x correspond to the same y, which is called a differentiable function.
  4. Because of the characteristic of polynomials that one x corresponds to one y, when there are two sets of data with the same x but different y values in the fitting data, polynomial fitting cannot be used at this time, nor can the fitting answer be obtained.