Numpy mathematical operations on an array are done element by element. So
we can construct a cosine wave with frequency 1/8 by discretely
sampling
using values in the array t above:

Numpy has applied the same operation to each of the elements of the
array t and created and printed a new array with the
results in the same order. Notice that we must use the numpy version
of cosine np.cos. Also, numpy gives us the value of
as np.pi, so we don't need to spell it out.