I have a list of $218$ points. Is it possible to find an equation for a line that passes through the points?
Update: Is there a software that can generate the equation from the points?
I have a list of $218$ points. Is it possible to find an equation for a line that passes through the points?
Update: Is there a software that can generate the equation from the points?
On
To answer your update, I would suggest using SciPy's polyfit function (if what you're really looking for is a linear regression). You can see an example here. If you want a polynomial that passes through all points, you can use the same code, but change the order of polyfit from 1 to 217. I recommend SciPy instead of different packages because it does not require you to purchase a license.
On
I'd recommend Excel. Use your point data to make a chart. Then right-click on the graph, and choose "Add Trendline". A dialog appears that lets you fit several different types of curves to your data. One of the options is a polynomial curve, with degree of at most 6.
If you need the equation of the fitted curve, then the dialog also has a check-box for "show equation on chart", which does what it says.
By default, the displayed equation will show the coefficients accurate to 4 decimal places, which may not be good enough for you. If so, right-click on the displayed equation, and choose Format Trendline Label. A dialog appears that lets you change the number of decimal places displayed. Then you can copy/paste this equation to anyplace you want.
The functions are simple, but, if necessary, you can find many tutorials showing you how to use them.
On
If all 218 point line on one line, then choose any two points and apply the slope formula to find an equation for that line:
$$m = \frac{y_0 - y_1}{x_0 - x_1}$$
Then the line is of the form:
$$y = mx + c$$
Pluging any value for $y$ and $x$ you'll be able to obtain $c$.
If they don't lie on a line and if you want an exact polynomial-like functiona thata passes through all points, then do interpolation. I recommend Lagrange interpolation (polynomial), but you must be careful, because it works under specific condition. If the points don't satisfy those conditions, then try another type of interpolation.
And if you want just a good aproximizaton, then you can try the method of least squares. You can get a linear aproximization or a formula, depending of the type you choos.
If the points actually exactly lie on a line then just take the line through any of the two points.
If they only approximately lie on a line you probably want to do a linear regression. You can read about it by Googling "linear regression," or you can just load the data up into your favorite spreadsheet, insert a graph, right-click on the graph or something, and tell it to show a best-fit line.