Initializing help system before first use

Parsed and unparsed formulae

All formulae input into Xpress NonLinear are parsed into a reverse-Polish execution stack. Tokens are identified by their type and a value. The table below shows the values used in interface functions.

All formulae are provided in the interface functions as two parallel arrays:
 an integer array of token types;
 a double array of token values.

The last token type in the array should be an end-of-formula token (XSLP_EOF, which evaluates to zero).

If the value required is an integer, it should still be provided in the array of token values as a double precision value.

Even if a token type requires no token value, it is best practice to initialize such values as zeros.

Type Description Value
XSLP_COL column index of matrix column.
XSLP_CON constant (double) value.
XSLP_DEL delimiter XSLP_COMMA (1) = comma (",")
XSLP_COLON (2) = colon (":")
XSLP_EOF end of formula not required: use zero
XSLP_FUN user function index of function
XSLP_IFUN internal function index of function
XSLP_LB left bracket not required: use zero
XSLP_OP operator XSLP_UMINUS (1) = unary minus ("-")
XSLP_EXPONENT (2) = exponent ("**" or "^")
XSLP_MULTIPLY (3) = multiplication ("*")
XSLP_DIVIDE (4) = division ("/")
XSLP_PLUS (5) = addition ("+")
XSLP_MINUS (6) = subtraction ("-")
XSLP_RB right bracket not required: use zero
XSLP_VAR variable index of variable. Note that variables count from 1, so that the index of matrix column n is n + 1.

Token type XSLP_COL is used only when passing formulae into Xpress NonLinear. Any formulae recovered from Xpress NonLinear will use the XSLP_VAR token type which always count from 1.

When a formula is passed to Xpress NonLinear in "internal unparsed format" — that is, with the formula already converted into tokens — the full range of token types is permitted.

When a formula is passed to Xpress NonLinear in "parsed format" — that is, in reverse Polish — the following rules apply:

XSLP_DEL comma is optional.
XSLP_FUN implies a following left-bracket, which is not included explicitly.
XSLP_IFUN implies a following left-bracket, which is not included explicitly.
XSLP_LB never used.
XSLP_RB only used to terminate the list of arguments to a function.

Brackets are not used in the reverse Polish representation of the formula: the order of evaluation is determined by the order of the items on the stack. Functions which need the brackets — for example XSLPgetccoef — fill in brackets as required to achieve the correct evaluation order. The result may not match the formula as originally provided.