The above quantities are defined more precisely as follows:

{madlist}\ttitem

X Displacement of the local origin in X-direction. \ttitemY Displacement of the local origin in Y-direction. \ttitemZ Displacement of the local origin in Z-direction. \ttitemTHETA \(\theta\) is the angle of rotation (azimuth) about the global Y-axis, between the global Z-axis and the projection of the reference orbit onto the (Z, X)-plane. A positive angle THETA forms a right-hand screw with the Y-axis. \ttitemPHI \(\phi\) is the elevation angle, i.e. the angle between the reference orbit and its projection onto the (Z, X)-plane. A positive angle PHI correspond to increasing Y.
If only horizontal bends are present, the reference orbit remains in the (Z, X)-plane and PHI is always zero. \ttitemPSI \(\psi\) is the roll angle about the local s-axis, i.e. the angle between the line defined by the intersection of the (x, y)-plane and (Z, X)-plane on one hand, and the local x-axis on the other hand. A positive angle PSI forms a right-hand screw with the s-axis.

The angles (\(\theta\), \(\phi\), \(\psi\)) are not the Euler angles. The reference orbit starts at the origin and points by default in the direction of the positive Z-axis. The initial local axes (x, y, s) coincide with the global axes (X, Y, Z) in this order. The initial values (\(X_{0}\), \(Y_{0}\), \(Z_{0}\), \(\theta_{0}\), \(\phi_{0}\), \(\psi_{0}\)) are therefore all zero unless the user specifies different initial conditions.

Internally the displacement is described by a vector V and the orientation by a unitary matrix W. The column vectors of W are the unit vectors spanning the local coordinate axes in the order (x, y, s). V and W have the values:

\begin{equation} V=\begin{pmatrix}X\\ Y\\ Z\end{pmatrix},\qquad W=\Theta\quad\Phi\quad\Psi\\ \end{equation}

where

\begin{equation} \Theta=\begin{pmatrix}\cos\theta&0&\sin\theta\\ 0&1&0\\ -\sin\theta&0&\cos\theta\end{pmatrix},\quad\Phi=\begin{pmatrix}1&0&0\\ 0&\cos\phi&\sin\phi\\ 0&-\sin\phi&\cos\phi\end{pmatrix},\quad\Psi=\begin{pmatrix}\cos\psi&-\sin\psi&0\\ \sin\psi&\cos\psi&0\\ 0&0&1\end{pmatrix}\\ \end{equation}

The reference orbit should be closed, and it should not be twisted. This means that the displacement of the local reference system must be periodic with the revolution frequency of the accelerator, while the position angles must be periodic (modulo \(2\pi\)) with the revolution frequency. If \(\psi\) is not periodic (modulo \(2\pi\)), coupling effects are introduced. When advancing through a beam element, \madxcomputes \(V_{i}\) and \(W_{i}\) by the recurrence relations

\begin{equation} V_{i}=W_{i-1}R_{i}+V_{i-1},\qquad W_{i}=W_{i-1}S_{i}\\ \end{equation}

The vector \(R_{i}\) is the displacement and the matrix \(S_{i}\) is the rotation of the local reference system at the exit of the element i with respect to the entrance of the same element. The values of \(R_{i}\) and \(S_{i}\) are listed below for different physical element types.