X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fmath%2Fleastsqs.hxx;h=3889cf7a3e15bdc1a4f5a9cea63dd7f33d843fff;hb=ce54997be569ebcac4222321e7ae3fecccd01324;hp=7c8e21d32aeeaf027129d163ddcae62817fedb59;hpb=75911b6c643d8e5597565bc63c34bdc2009a037a;p=simgear.git diff --git a/simgear/math/leastsqs.hxx b/simgear/math/leastsqs.hxx index 7c8e21d3..3889cf7a 100644 --- a/simgear/math/leastsqs.hxx +++ b/simgear/math/leastsqs.hxx @@ -5,7 +5,7 @@ // Written by Curtis Olson, started September 1997. // -// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com +// Copyright (C) 1997 Curtis L. Olson - http://www.flightgear.org/~curt // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -17,10 +17,9 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // -// You should have received a copy of the GNU Library General Public -// License along with this library; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // $Id$ @@ -29,9 +28,9 @@ #define _LEASTSQS_H -#ifndef __cplusplus +#ifndef __cplusplus # error This library requires C++ -#endif +#endif /** @@ -42,12 +41,12 @@ Classical least squares fit: \f] \f[ - b_1 = \frac{n * \sum_0^i (x_i*y_i) - \sum_0^i x_i* \sum_0^i y_i} - {n*\sum_0^i x_i^2 - (\sum_0^i x_i)^2} + b_1 = \frac{n * \sum_0^{i-1} (x_i*y_i) - \sum_0^{i-1} x_i* \sum_0^{i-1} y_i} + {n*\sum_0^{i-1} x_i^2 - (\sum_0^{i-1} x_i)^2} \f] \f[ - b_0 = \frac{\sum_0^i y_i}{n} - b_1 * \frac{\sum_0^i x_i}{n} + b_0 = \frac{\sum_0^{i-1} y_i}{n} - b_1 * \frac{\sum_0^{i-1} x_i}{n} \f] */ void least_squares(double *x, double *y, int n, double *m, double *b);