Next: E208 Least Squares
Up: CERNLIB
Previous: E106 Binary Search
Routine ID: E201
| Author(s): K.S. Kölbig | Library: MATHLIB
|
Submitter: | Submitted: 01.12.1994
|
Language: Fortran | Revised:
|
Subroutine subprograms RLSQPM and DLSQPM fit a polynomial
of degree m to n equally-weighted data points (
).
The calculated coefficients
are such that
Subroutine subprograms RLSQP1 and DLSQP1 fit a straight
line
to n such points.
Subroutine subprograms RLSQP2 and DLSQP2 fit a parabola
to n such points.
An estimate
of the standard deviation
is calculated.
On CDC and Cray computers, the double-precision
versions DLSQPM, DLSQP1 and DLSQP2 are not available.
Structure:
SUBROUTINE subprograms
User Entry Names: RLSQPM, RLSQP1, RLSQP2,
DLSQPM, DLSQP1, DLSQP2
External References:
RVSET, DVSET, DVSUM, DVMPY (F002),
DSEQN (F012)
Usage:
For
(type REAL),
(type
DOUBLE PRECISION),
CALL tLSQPM(N,X,Y,M,A,SD,IFAIL)
CALL tLSQP1(N,X,Y,A0,A1,SD,IFAIL)
CALL tLSQP2(N,X,Y,A0,A1,A2,SD,IFAIL)
- N
- ( INTEGER) Number n of data points.
- X
- (type according to t)
One-dimensional array of length
.
On entry, X(i) contains the abscissas
.
- Y
- (type according to t)
One-dimensional array of length
.
On entry, Y(i) contains the ordinates
.
- M
- ( INTEGER) Degree m of the polynomial to be fitted.
- A
- (type according to t) One-dimensional array of
dimension (0:d), where
. Contains, on exit,
in A(j) the coefficients
.
- A0,A1,A2
- (type according to t)
Contain, on exit, the coefficients
,
for
or
for
, respectively.
- SD
- (type according to t) Contains, on exit,
the estimate s.
- IFAIL
- ( INTEGER) Error flag.
Normal case,
or
or
or
,
The matrix of normal equations is numerically
singular.
In the case
:
,
and
on exit.
Method:
The normal equations are solved. On computers other than CDC or Cray,
double-precision mode arithmetic is used internally for RLSQPM,
RLSQP1 and RLSQP2.
Notes:
Meaningful results can usually be obtained only for small values
of m (typically
).
References:
- D.H. Menzel, Fundamental formulas of physics, v. 1,
(Dover, New York 1960) 116--122.
E208
Next: E208 Least Squares
Up: CERNLIB
Previous: E106 Binary Search
Janne Saarela
Mon Apr 3 15:06:23 METDST 1995