Creating and Editing Vectors
Vector Operations

Creating and Editing Vectors
There are two ways to create a vector:
- Define a variable to be a comma separated list of objects
- Define a variable to be vector(n), where n is the length of the vector.
Example
Note that when the applet evaluated and printed vector a, it put the components inside a set of parentheses.
You may use parentheses when you define the vector, but it is not necessary.
Once a vector has been defined you access its components with subscripts. The subscript 1 denotes the first
component.
Example
If a variable is used as subscript, then that variable becomes an index used to define all the components.
Example

Vector Operations
Vectors of the same dimension may be added or subtracted, and vectors may be multiplied or divided by scalars.
Example
The dimension of a vector can be found by evaluating length(<vector name>).
The vector dot (scalar) product is obtained by <ctrl>w, and cross product with <ctrl>e. The arguments
of the cross product must be either dimension two or three. When one of the arguments of the cross product is a
two vector, then a three vector is produced by making the third component 0.
Example
|