18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Programming</strong> <strong>Language</strong> Concepts<br />

for I = 1 to 6,<br />

with (I < N and X(I) < X(I+1)) or I = N,<br />

compute<br />

NX as the number, SUMX as the sum, NM as the mean,<br />

SSQX as the sum.of.squares, MSQX as the mean.square,<br />

VARX as the variance, SDVX as the std.dev,<br />

MINX as the minimum,<br />

MAXX as the maximum, MINI as the min(I) of X(I)<br />

The above statement iterates the control variable I over the values 1, 2, 3, 4, 5, and 6, and<br />

selects only those values for inclusion in the compute statement computations for which I < 5<br />

and X(I) < X(I+1), or for which I equals 5. Thus, it selects X(2), and X(4) under condition 1<br />

and X(5) under condition 2. For these index numbers, the statistical quantities are computed for<br />

the expression X(I). The computed statistics are:<br />

Computed<br />

Variable Statistic Computation<br />

NX NUMBER 4<br />

SUMX SUM 4.0 + 7.3 + 0.5 + 2.2 = 14.0<br />

NM MEAN 14.0 / 4 = 3.5<br />

SSQX SUM.OF.SQUARES (4.0) 2 + (7.3) 2 + (0.5) 2 + (2.2) 2 =<br />

74.38<br />

MSQX MEAN. SQUARE 74.38 / 4 = 18.595<br />

VARX VARIANCE 18.595 - 3.52 = 6.345<br />

SDVX STD.DEV SQRT.F(6.345) = 2.52<br />

MINX MINIMUM 0.5<br />

MAXX MAXIMUM 7.3<br />

MINI MIN(I) 4<br />

3.4 Input/Output Statements<br />

The read, write, and list statements as described so far provide facilities to:<br />

1. Read data in free form from an input data stream<br />

2. Display messages and computational results in picture like formats<br />

3. Generate labeled output data in a standard predefined format. No mention has been made<br />

of any selection capability for the source of input data or the destination of output data.<br />

In practice, you may desire to associate an input or output data stream with any one of the variety<br />

of input and output devices, such as terminals, tape drives, or line printers, which may be connected<br />

103

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!