Arrays are variables which can contain information in individually accessible memory locations. The syntax is
name[k]
to access the kth location of the variable named "name". Recall that the array index is an integer which refers to the individual memory location within the locations set asides for the array. Maple automatically sets asides memory space for an array. The user can also request a variable of array type with arbitrary range of the index. The syntax is
name := array ( min_value..ma_value)
to create an indexed variable with index in the range min_value to max_value.
Arrays are ideal to use with "for" loops to define and access the individual elements of arrays. The following worksheet defines two arrays, x[] and y[], set their contents, and then uses a loop to "lprint" the values of each member of the two arrays.
The following plots the points defined by coordinates set up in the worksheet above. Note the syntax for the plot statement. The "print" and "plots" statements illustrate the use of implicit loops to scan arrays. The index used in these loops must be a variable which is "unassigned", i.e., never assigned so far.
Section 7.3
Chapter 7
Section 7.5
TOC
Any questions or suggestions should be directed to |