 Previous | Next Using matrices Home ▸ Documentation ▸ Smile ▸ Computing ▸ Smile's maths ▸ Using matrices SmileLab defines a data type which derives from array of real: matrix. A matrix is a structure (an AppleScript record) which contains, in addition to the data stored as an array of real, two positive integers which define a number of rows (nrows) and a number of columns (ncols). Thus, the array of real should contain exactly nrows * ncols values. matrices store 2-d parametric sets of scalars. For instance you would describe a 2-d parametric surface in a 3-d space with three matrices representing (x(u, v), y(u, v), z(u, v)). set x to {0, 1, 2, 2, 1, 0} set m to {class:matrix, ncols:3, nrows:2, array of real:x} When this makes sense, SmileLab will consider m as a 2-d array such as (for the example above):     0    1    2     2    1    0 The array of real field of the matrix stores the 2-d array first row first. To make the values contained in an matrix into a tabulated text, use the display command. set x to {0, 1, 2, 2, 1, 0} set m to {class:matrix, ncols:3, nrows:2, array of real:x} quietmsg(display m) -- Result:     0.0    1.0    2.0     2.0    1.0    0.0 To visualize a matrix in few seconds use QuickBitMap or QuickScalarMap. set x to {0, 1, 2, 2, 1, 0} set m to {class:matrix, ncols:3, nrows:2, array of real:x} QuickBitMap(m, 0)  Version française Copyright ©2008 Paris, Satimage