The linear regresion by minimum squares is the most quite complicated operation required during physical workshops. Once upon a time I was given the program Regresio, developed by two teachers of my Faculty. Sadly it is a TurboBasic code (they gave it to me when I told them I was interested in a C port of it), and the program is just compiled for MS-DOS. Fortunately, by the other hand, this pushed me to develop the library and program you are using now. This time free software users will be able to have a nice tool to get the job done.
It's straightforward to enter the x data as a single string in the x entry, each real (double) number separated by one single whitespace from the next one. The same with the y data entry. I found it difficult to know how many y elements I already entered while probing the program, that's why there is a 'y elem left' counter close to the data input to remember you how many y elements left you have to enter so the number of elements in the x data and the y data is the same.
You can select the number of iterations used by the Gauss-Seidel method too, which is 1000 by default. The order of the polinomy to use is also editable.
Plots can be obtained by clicking over the plot button. They will arise in the 'Plot' tab. They are partially implemented as Gtk# is uncomplete now. For example, regresion lines can't be shown.
Here there is the API so you can develop your own programs with the library.
Method | Description |
public static double[] Regres (double[] xarr, double[] yarr) | Returns the coefficients of the regresion polinomy using 15000 iterations and order 1. |
public static double[] Regres (double[] xarr, double[] yarr, int n, long iter) | Returns the coefficients of the regresion polinomy. |