A vector is an ordered list of objects. ABC supports real numbers and complex numbers. You can extract a component from a vector by putting the 1 based index of the component in parenthesis after the vector.
For Example: [1,2,3](3) = 3
The components of the vector are listed in square brackets.
Some valid vectors: [1,2,3], [2+3, 4*(89+3)], [1+2i, 3i, 2]
Operator | Description | Examples |
---|---|---|
x + y | Adds two vectors. They must have the same number of components | [1,2,3]+[4,5,6] |
x - y | Subtracts two vectors. They must have the same number of components | [1,2,3]-[4,5,6] |
x * y | Scalar multiplication. | [1,2,3]*2, 2*[1,2,3] |
x / y | Scalar division. x is a vector, y is a scalar | [3,6,9]/3 |
x . y | Dot product | [1,2,3].[1,1,1] |
x & y | Concatenation. Appends the components of y to the end of x | [1,2,3] & [4,5,6] |
dim x | Gives the number of components of vector x | dim [1,2,3] |
mkv(x, y) | Generates a vector. y is the number of components. x is either a constant or a function. If x is a constant, all the components of the generated vector are that constant. If x is a function, it takes a single int argument representing the component to generate. The function is then called to generate the vector components. | mkv(1,3) (a vector of 1s), mkv({int _i|_i^2}, 3) (a vector of squared numbers) |