next up previous contents index
Next: Real Vector Variables Up: Variable Definitions Previous: Variable Definitions   Contents   Index


Real Scalar Variables


REAL variable-name=real-expression;
The keyword REAL is optional. For backward compatibility the program also accepts the form

variable-name:=real-expression;
This statement creates a new global variable variable-name and discards any old variable with the same name. Its value depends on all quantities occurring in real-expression. Whenever an operand changes in real-expression, a new value is calculated. The definition may be thought of as a mathematical equation. However, MAD is not able to solve the equation for a quantity on the right-hand side.

An assignment in the sense of the FORTRAN or C languages can be achieved by using the EVAL function.

A reserved variable is the value P0 which is used as the global reference momentum for normalising all magnetic field coefficients. Example:


REAL GEV=100;
P0=GEV;
Circular definitions are not allowed:

X=X+1;    // X cannot be equal to X+1
A=B;
B=A;      // A and B are equal, but of unknown value
However, redefinitions by assignment are allowed:

X=EVAL(X+1);



MAD User Guide, http://wwwslap.cern.ch/mad/