Vanguard Software
Forecasting & Planning Solutions
Home Products Solutions Services Customers Partners Company
 
Applying science to business management

contents.gifindex.gifprev1.gifnext1.gif

dim

Format: dim( n1, n2, ... )

Arguments: (int) n1, n2 ,... Number of elements in each dimension

Returns: [int] Array of zeros with the dimensions specified by n1, n2, ...

Description: The dim primitive is used to initialize an array of variables that will later be assigned values using the Assign operator. If only one argument is supplied, e.g., dim( n1 ), a list of n1 zeros is created. If two arguments are supplied, e.g., dim( n1, n2 ), a matrix of n1 rows and n2 columns is created. This pattern is continued for arrays of any number of dimensions.

Examples: var x=dim(10); = declares x to be a list of 10 values

x[2]=12 = assigns 12 to the 3rd element in the array x

x=dim(10,5) = declares x to be a 10 by 5 array

x[1][2]=9 = assigns 9 to the 3rd element of the 2nd list in the array x


The following procedure creates a list of n^2 for n = 0 to 9.

Proc:={
var x=dim(10);
for(var n=0; n<10; n++)
  x[n]=n*n;
return x;
}

See Also: Assign, makelist

  Demand Planning  |  Financial Forecasting
Forecasting Software  |  Strategic Planning Software  |  Decision Tree Software
Decision Support Software  |  Expert System Software  |  Online Surveys

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2011 Vanguard Software Corporation
Print this page   Email this page to a friend