2

If we have a set of points could plot a freehand graph like in the picture below:

enter image description here

If we have a set of infinite points then the function would presumably be smoother. How do we find the equation of the curve based on the set of points? Is this possible?
For example: For a straight line, we use the two-point form, or the point slope, is there a general way to define an n th degree curve?

1 Answers1

3

Yes this is possible. You first need to assume a form for the equation. That is to say for example that \begin{equation} y = f(x, \theta) \end{equation} in which $f$ is some polynomial with fixed order for example. The parameter vector $\theta$ contains the coefficients of the polynomial. This is what we are after. To evaluate $\theta$ you can use the least squares method. You will need number of points more than or equal to the number of unknown coefficients of the function $f$.

The least squares method minimizes the sum \begin{equation} \sum_{k=1}^K (y_k - f(x_k, \theta))^2 \end{equation} over $\theta$. Here $K$ is the total number of available points.

Check the wikipedia page: Least Squares

user144410
  • 1,312
  • are there any softwares that would give us the equation inputting a number of points? – BumbleBee Mar 12 '17 at 15:49
  • Sure. I think most of the available softwares will do this. Check Matlab, Mathematica, or R. In any case you can code it yourself. It is very simple. What you are basically doing is solving a system of linear equations (you only need to invert a matrix). – user144410 Mar 12 '17 at 15:52
  • @user14410, do you know it in geogebra or desmos? – BumbleBee Mar 12 '17 at 16:01
  • I have never used those: but check this https://www.geogebra.org/m/jJkZQ7og – user144410 Mar 12 '17 at 16:06