www.delorie.com/gnu/docs/calc/calc_127.html | search |
Buy the book! | |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The vector data type is flexible and general. A vector is simply a list of zero or more data objects. When these objects are numbers, the whole is a vector in the mathematical sense. When these objects are themselves vectors of equal (nonzero) length, the whole is a matrix. A vector which is not a matrix is referred to here as a plain vector.
A vector is displayed as a list of values separated by commas and enclosed in square brackets: `[1, 2, 3]'. Thus the following is a 2 row by 3 column matrix: `[[1, 2, 3], [4, 5, 6]]'. Vectors, like complex numbers, are entered as incomplete objects. See section 5.13 Incomplete Objects. During algebraic entry, vectors are entered all at once in the usual brackets-and-commas form. Matrices may be entered algebraically as nested vectors, or using the shortcut notation `[1, 2, 3; 4, 5, 6]', with rows separated by semicolons. The commas may usually be omitted when entering vectors: `[1 2 3]'. Curly braces may be used in place of brackets: `{1, 2, 3}', but the commas are required in this case.
Traditional vector and matrix arithmetic is also supported; see section 8.1 Basic Arithmetic and see section 10. Vector/Matrix Functions. Many other operations are applied to vectors element-wise. For example, the complex conjugate of a vector is a vector of the complex conjugates of its elements.
Algebraic functions for building vectors include `vec(a, b, c)' to build `[a, b, c]', `cvec(a, n, m)' to build an nxm matrix of `a's, and `index(n)' to build a vector of integers from 1 to `n'.
webmaster donations bookstore | delorie software privacy |
Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |