# Arithmetic Expressions in VISTA

Here we review the syntax of mathematical expressions. Any user who wishes to use VISTA effectively should review this section carefully.

Arithmetic expressions come in four types:

1. An explicit numeric value. Examples are: 3, 3.14159, -59.39, 2.32E-05
2. Variable names. Variables are created and their values assigned with the SET command. Variable names must be composed of alphanumeric characters. There can be up to seven characters in the name. The first character of the variable name should be an alphabetic character.
3. Data file references. Data file references allow you to use numeric values from a VMS ASCII text file. Data file references begin with the @ symbol followed by the file name, a period (.), and then the column number. The column number can itself be either a numeric integer constant or a variable name. An example is given in the description of the READ command.
4. Constants or variables connected with arithmetic operators or using functions (general arithmetic expressions).

The following table lists arithmetic functions supported in VISTA, with examples of their use. ('Binary' means relating two objects - 'unary' means applying to one object.)

 Symbol Function Examples + binary addition B+C 2+5 - binary subtraction B-C 2-5 * binary multiplication B*C 2*5 / binary division B/C 2-5 - unary negation -B ^ exponentiation A00.5 10^3 = equate A=B A=B=3

The following logical operators are also supported.

 Symbol Function Examples logical greater than AB A2.5 logical less than AB A100 == logical equal to A==B A==10 = logical not equal to A =B A =10 = logical less than or equal to A=B A=5 = logical greater than or equal to A=B A=3

Logical operators return a value of either 1 (true) or 0 (false).

Expressions are evaluated in the same order as they are in FORTRAN. You may change the order of evaluation using parentheses "()". An example is

VISTA supports a variety of functions. The argument to the function is contained in square brackets. The following functions are currently supported:

Arithmetic Functions:

Trignonmetric Functions:

Image Parameters:

Examing/Editing Image Data:

Functions may be used as arguments of other functions. Functions can contain expressions of arbitrary complexity (so long as the parentheses are balanced and there are no extraneous spaces!).

IMPORTANT!

Variable names or arithmetic expressions may be used ANYWHERE an explicit constant may be used in keyword-value expressions. Recall that such an expression has an 'option=value' construction. For example, if you wanted to plot row 200 of image 4 over columns X to X+50, (where X is some variable) you could say

Note that R, XS, and XE are keywords, not variables and the equal sign following them is not interpreted as an arithmetic operation. However, since everything following the first = is an arithmetic expression, you could save the 'value' of, for instance, XE, by doing the following

The variable XLAST takes on the value of X+50.