BESTFIT

explanation

 Suppose you have an error vector, E, with length N, and that you
 have M variable parameters. The measured effect of a unit change
 for each of the parameters at each of the N locations is stored in
 a matrix, PM, with N rows and M columns.  Suppose you have a vector
 P, of length M, which represents the resistences to change of the M
 parameters, that is, the larger P[i] the smaller will be the
 adjustment of the i_th parameter. The optimal set of changes of the
 M parameters within their allowed range, PMIN to PMAX, will be
 determined in the `least-squares sense'. A vector, POUT, will be
 created with length M and filled with the parameter changes giving
 this `best' fit.

WEIGHTS

 Syntax: BESTFIT\WEIGHTS w pmin pmax penalty error parm pout
         BESTFIT\WEIGHTS\CYCLES w n pmin pmax penalty error parm pout

 If the \WEIGHTS qualifier is used, a weight vector, w, will be
 expected. The weight vector should have length N, the length of the
 error vector. The weight, w[i], corresponds to the `importance' of
 reducing the initial error to zero at the i_th location. The closer
 to zero the value of w[i], the looser will be the fit at the i_th
 location.  If the \CYCLES qualifier is also used, the weight array
 comes before the iteration number in the parameter list.

CYCLES

 Syntax: BESTFIT\CYCLES n pmin pmax penalty error parm pout
         BESTFIT\WEIGHTS\CYCLES w n pmin pmax penalty error parm pout

 The \CYCLES qualifier allows the user to specify the maximum
 number of iteration steps for the fit. When this maximum number is
 reached, the fit will stop. The fit will also stop if the fit is
 successful before this maximum iteration number is reached.  If the
 \WEIGHTS qualifier is also used, the weight array comes before the
 iteration number in the parameter list.