Storing a list of numbers in one vector allows Octave to use some of its more powerful
features to perform calculations. In C++ if you wanted to do the same operation on a
list of numbers, say you wanted to multiply each by 2, you would have to use a for loop
to step through each element. This can also be done in Octave (see Section 7), but it is
much better to make use of Octave’s vector operators.
Multiplying all the numbers in a vector by the same number, is as simple as multiplying
the whole vector by number. This example uses the vector a defined earlier: