
224 Introduction to Computational Modeling
element 3 = 5.25
element 4 = 5.25
element 5 = 0.25
element 6 = 0.25
element 7 = 0.25
17.5 Simple Vector Operations
Operations on vectors are performed with a vector and a scalar or with two vec-
tors. These are performed by calling GSL functions in C.
17.5.1 Arithmetic Operations
To add a scalar to a vector involves adding the scalar value to every element of
the vector. With C and GSL, calling function gsl vector add constant. This function
adds the specified constant value to the elements of the vector specified.
In the following portion of code, vector pv is created and then its elements are
assigned values. On ...