7.2  iota and  spanl

The function iota is particularly handy if you wish to graph a function at an equally spaced set of points.

iota(n)

will give you a vector whose components are 1, 2, 3, ... , n.

iota(m,n) #or iota(m:n)
 

will give you a vector whose components are m, m1+, m2+, ... , n. Thus, for example, you can get a vector of all the points a tenth of a unit apart in the unit interval [0,1], and the corresponding values of a function f, by writing

real x = 0.1 * iota ( 0 , 10 ) , y = f ( x )
 

Note that in Basis you need not specify the dimension of a variable that is initialized with a vector or array when it is declared. It will be automatically dimensioned properly (with all subscripts based at 1). Note that real x = 0.:1.:.1 would have accomplished the same result, as would real x = 0.:1.:11.

The function spanl is used to obtain a vector of points which are logarithmically spaced between two given points, rather than linearly spaced as one would obtain with  iota. To get the eleven logarithmically spaced points in the interval [0,1] use

spanl ( 0., 1., 11 )
 

The first two arguments are the endpoints of the interval, and the third is the total number of points desired.