next up previous
Next: Line geometric aberrations :one Up: Use and description of Previous: Layout printing of machine

Least square fit

This operation handles most fitting problems. Some care must be exercised in the choice of nstep and nit. Experience will show what choices are best suited to the problem. A safe choice is 2 2 (1 1 is faster but less accurate). If the program is very slow at finding a solution or if overflow condition is developed in the subroutine LMDIF, the solution sought is probably not a practical one. The new minimizer LMDIF was installed in December 1984. It has a default tolerance and default increments for the variables which seem adequate. As a consequence the input parameters del(i) have no influence. We have kept them to avoid changes in the input format.


Input format 

LEASt square fit of .....(up to 80 char)
nstep nit nvar ncond
$\beta_{x},\alpha_{x},\eta_{x},\eta'_{x}, \beta_{y},\alpha_{y},\eta_{y},\eta'_{y}$
name$_{i}$ pkeyw$_{i}$ del$_{i}$ for i = 1 to nvar
nval$_{j}$ valf$_{j}$ weight$_{j}$ for j = 1 to ncond
nasp
repeat the following nasp times
name$_{1}$ npas
name$_{k}$ pkeyw$_{k}$ coef$_{k}$ for k = 1 to npas

Parameter definitions

nstep $\textstyle \parbox{10cm}{ number of steps taken to approach final fit.}$

nit $\textstyle \parbox{10cm}{ number of iterations used in final step of fit.}$

nvar $\textstyle \parbox{10cm}{ number of independent variables(max:mxlvar).}$

ncond $\textstyle \parbox{10cm}{ number of conditions to be met(max:mxlcnd).
Note tha...
... satisfy the condition
\begin{displaymath}nvar\ <= \ ncond \end{displaymath}}$

$\beta_{x} \dots \eta'_{y}$

$\textstyle \parbox{10cm}{
initial values needed for the function computation.W...
...values computed in the last matrix
operation preceding the present operation.}$

name$_{i}$

$\textstyle \parbox{10cm}{
name of element with an independent parameter to be
varied.}$

pkeyw$_{i}$ $\textstyle \parbox{10cm}{ variable element parameter keyword}$

del$_{i}$

$\textstyle \parbox{10cm}{
this parameter is not used in the new minimizer
imp...
...ation, but was kept in the input to avoid a
major change in the input format.}$

nval$_{j}$:

$\textstyle \parbox{10cm}{
reference number of output value to be fitted.
\par...
...tay, dmuy/ddelta,
chromy (chromaticity in y), dalphay/ddelta, dbetay/ddelta.}$

$\textstyle \parbox{10cm}{
Numbers 65 to 68 refer to detax/ddelta detapx/ddelta...
... detapy/ddelta as computed in the stable
motion analysis of the total matrix.}$

$\textstyle \parbox{10cm}{
Numbers 21 to 30 refer to betax alphax etax etapx nu...
...puted from the initial values
present in the second line of the input format.}$

$\textstyle \parbox{10cm}{
Numbers 31 to 40 refer to the values betax nuy computed
at the first fit point defined by the preceding SET Fit
point operation.}$

$\textstyle \parbox{10cm}{
Numbers 1031 to 1040 refer to the difference between...
...econd
fit point defined by the preceding SET Fit point
operation.(ie.:v2-v1)}$

$\textstyle \parbox{10cm}{
Numbers 41 to 61 refer to the beam values sigx ...
...
...am values
at the begining of the machine has preceded the fitting
operation.}$

$\textstyle \parbox{10cm}{
Numbers 71 to 91 refer to the same beam values computed
at the first fit point defined by the operation SET Fit
point.}$

$\textstyle \parbox{10cm}{
Numbers 1071 to 1091 refer to the differences of the...
...irst and second fit
point defined by the operation SET Fit
point.(ie.:v2-v1)}$

$\textstyle \parbox{10cm}{
Numbers 93 to 98 fit the average chromatic errors fo...
...on is done which
serves to define the parameters needed for the
computation.}$

$\textstyle \parbox{10cm}{
Selected numbers 110 to 666 specify matrix elements ...
...ents the second order matrix element
T(i,j,k) (as in the TRANSPORT notation).}$

valf$_{j}$

$\textstyle \parbox{10cm}{ value to be achieved.}$

weight$_{j}$

$\textstyle \parbox{10cm}{
weight attached to the value(j) in the fit function.}$

nasp

$\textstyle \parbox{10cm}{
number of associated parameters. If nasp = 0, then the
following data is not to be entered.}$

name$_{1}$

$\textstyle \parbox{10cm}{
name of the basic parameter to which the associated
parameters are connected. It must be present in the
list of basic parameters.}$

npas $\textstyle \parbox{10cm}{
number of parameters to be associated to name1 (max:6).}$

name$_{k}$

$\textstyle \parbox{10cm}{
name of one element having a parameter associated to
name1.}$

pkeyw$_{k}$

$\textstyle \parbox{10cm}{
keyword of the parameter of name$_{k}$\ associated with
name$_{1}$.}$

coef$_{k}$

$\textstyle \parbox{10cm}{
coefficient with which the BASE parameter (that of
...
...e multiplied to obtain the value of the
\newline
\par
parameter of name$_{k}$.}$



Examples

The first two examples come from demo1. The second example is given to illustrate the use of associated parameters. Refer to demo1 for the meaning of the element names.

The third example comes from demo4. It illustrates the use of associated parameters and shows how beam matrix elements can be fitted.

least square FIT OF QUADRUPOLE STRENGTH FOR A 90 DEGREE CELL.
1 1 2 2
* since this a cell fit the twiss values are irrelevant but
* values must be put in (beta =/ 0)
1.0 0 0 0
1.0 0 0 0
QFONE K1 .001
QD1 K1 .001
2 .25 1.0 12 .25 1.0
0;

least square FIT OF QUADRUPOLE STRENGTH FOR A 90 DEGREE CELL.
1 1 2 2
1.0 0 0 0
1.0 0 0 0
QFONE K1 .001
QD1 K1 .001
2 .25 1.0 12 .25 1.0
1
QFONE  1
QFTWO K1 1.0,


LEAST SQUARE FIT FOR COMPENSATION OF SOLENOIDAL FIELD
1 2 8 12
0.53 0 0 0 0.04 0 0 0
Q1 K1 .001 Q2D K1 .001 Q3D K1 .001
QSKEW1 K1 .001 QSKEW2 K1 .001
QSKEW3 K1 .001 KQ5E ANGLE .001 EFSA L .0001
21 8.975 1 22 1.3341 1 26 20.709 1 27 1.2077 1
130 0 1 140 0 1 230 0 1 240 0 1
310 0 1 320 0 1 410 0 1 420 0 1
2
EFSA 3
E41X L -1
E42E L 1
FSB L -1
KQ5E 1
KQ4X ANGLE -1,


next up previous
Next: Line geometric aberrations :one Up: Use and description of Previous: Layout printing of machine
Dobrin Kaltchev 2004-10-20