This post grew out of a discussion I had with my son who is now learning physics at the high school level.  He was reading his text book with the old, time-honored discussion of vectors being things with directions and magnitudes.  This is certainly true for physical vectors that describe things like displacement, velocity, force, torque, and electric and magnetic fields – all the typical menagerie that introductory physics students encounter.

But I couldn’t resist talking to him about vector spaces in general.  It has long baffled me why we teach kids from the beginning the dumbed-down version of things then make them unlearn it later on.  From what I can tell, the really creative thinkers of history were ones who didn’t succumb to this mind-numbing nonsense.  They were people who didn’t let the accepted way of doing things constrain them.  If they had, we would never have heard of them.

Thus I resolved to talk to him about vectors in general.  I introduced him to the rules for defining a vector space.  A short aside is warranted on this point.  Depending on which textbook you read, there are subtle differences in what is presented.  Some books enumerate only eight properties, some only seven, and the ones that do it best list 10.  All of them functionally amount to the same thing but standardization seems to elude the community at large, much to the confusion of students.

I touched on all the abstract definitions and properties just to show that there was a firm structure we could build on, but I emphasized that the prototype example of a vector that one could almost always use and never be led astray was a list.  I emphasized that what made the list useful was that it was a vector space in its own right and that almost all other vector spaces could be put into correspondence with a list.  I also emphasized that, while the list was helpful, it is often only a representation of the vector in question, and that we shouldn’t be seduced into thinking it was the vector itself.  A velocity vector is no more a list of numbers than Bernard Riemann is the list of pixels in the 2-array of light and shadow below.

Bernard_Riemann

We finished our discussion by touching on infinite-dimensional vector spaces, and I could see that what I really needed was a concrete example that he could play with.  After about an hour of back-and-forth I finally came up with something that he seemed to grasp.  I offer it here in the hopes that others will be able to use it as well.

What I wanted to create was a model where four properties were met:

  • The basic units are lists
  • These lists can be added component-wise
  • The lists can be infinite
  • The lists can be directly translated into a picture that visualizes magnitude and direction

A note is needed on the point that the lists can be infinite.  By this I mean that the length of the list was limited only by our patience and aesthetics or by the physical memory of the machine.  Much in the usual idea of infinity, I wanted a system where the student could always reach into the bag and pull out another dimension (being assured that the student would tire before the computer would).

The model that I created is expressed in the computer algebra system wxMaxima 11.08.0 running Maxima version 5.25.0. I like Maxima for several reasons, chief amongst them being that it is very capable and it is free.

Being based on LISP, Maxima is quite comfortable handling the first property.  For the second and third properties, I wanted a way to add lists of different lengths, so that the student would never encounter a limitation saying that one list was as long as another.  A different way of expressing that is to say that if there are two lists
\[ M = \left[ m_1, m_2, m_3 \right]\]
\[ N = \left[ n_1, n_2, n_3, n_4, n_5 \right]\]
they are not actually different in length since we can always imagine that they list only the portions of themselves beyond which there are only zeros (i.e. $$m_3$$ and $$n_5$$  are the last non-zero entries in their respective lists) so that they actually look like
\[ M = \left[ m_1, m_2, m_3, 0, 0, 0,…,0,… \right]\]
\[ N = \left[ n_1, n_2, n_3, n_4, n_5,0,…,0,… \right]\]
To do this I wrote a small Maxima function called add_lists that pads the smallest of the two lists with zeros and then returns the sum.  The code for it is

add_lists(a, b)  := block([ret_lst],
                      Na    : length(a),
                      Nb    : length(b),
                      delta : abs(Na-Nb),
                      pad   : makelist(0,i,1,delta),
                      if Na > Nb 
                         then ret_lst : a + append(b,pad) 
                         else ret_lst : append(a,pad) + b);

For the final property, I decided that a plot of a Fourier series in the interval $$[0,L]$$ would correspond to the visual addition of the vectors.

The particular choice of Fourier series is the cosine series given by
\[ f(x;L) = \sum_{n=1}^{\infty} a_n \cos \left( \frac{ 2 \pi n x}{L} \right) \; , \]
where the constant offset term given by $$a_0$$ has been set equal to zero and the presence of the term L there to remind us of the interval over which the function is defined.   Traditional treatments in advanced mathematics and quantum texts, drive the point that the sine and cosine function are orthogonal polynomials
\[ \int_0^{2 L} dx \cos \left( \frac{ 2 \pi n x}{L} \right) \cos \left( \frac{ 2 \pi p x}{L} \right) = \delta_{np} L \]
\[ \int_0^{2 L} dx \sin \left( \frac{ 2 \pi n x}{L} \right) \sin \left( \frac{ 2 \pi p x}{L} \right) = \delta_{np} L \; \; (n \neq 0)\]
\[ \int_0^{2 L} dx \cos \left( \frac{ 2 \pi n x}{L} \right) \sin \left( \frac{ 2 \pi p x}{L} \right) = 0 \]
in a Sturm-Liouville sense and thus are basis vectors in some abstract space.  The coefficients $$a_n$$ are then the components of the general vector (function)  in this space.  While important to the theoretical underpinnings, these relationships obscure what is really a rather simple concept that two sets of constants can be added together as a short hand for adding the two trigonometric series together and thus lists of these constants form a vector space in their own right.

Thus the list $$A = \left[a_1, a_2, …\right]$$ is the representation of the vector (in component or list form) and the function fourier_series given by

fourier_series( lst, L ) := block([expr],
                                  expr : 0,
                                  for i : 1 step 1 thru length(lst) do 
                                   ( temp_expr : lst[i]*cos(2*%pi*i*x/L),
                                     expr : expr + temp_expr ),
                                  expr);

is what delivers the corresponding expression that is plotted.

The final step is to take two lists, plot them separately to give the ‘direction and magnitude’ of each, and then to add them together plot-wise (that is to say plot the sum of the expressions) and show that the resulting vector is the same that is obtained if the two lists of coefficients are add together first and then plotted.

For a concrete example take the lists
\[A = \left[-1,\frac{1}{2},-\frac{1}{3},\frac{1}{4},-\frac{1}{5},\frac{1}{6},-\frac{1}{7}\right] \]
and
\[B = \left[1,\frac{4}{5},\frac{3}{5},\frac{2}{5},\frac{1}{5}\right] \; .\]

Lists $$A$$ and $$B$$ produce a plot of $$f_A(x;L)$$ and $$f_B(x;L)$$ over the interval $$x \in \left[0,L\right]$$
fourier_vector_plot_A_and_B
With corresponding expansions of fourier_series(A,L)
$$f_A(x;L) = -{{\cos \left({{7\,\pi\,x}\over{5}}\right)}\over{7}}+{{\cos \left({{6\,\pi\,x}\over{5}}\right)}\over{6}}-{{\cos \left(\pi\,x\right)}\over{5}}+{{\cos\left({{4\,\pi\,x}\over{5}}\right)}\over{4}}-{{\cos \left({{3\,\pi\,x}\over{5}}\right)}\over{3}}+{{\cos \left({{2\,\pi\,x}\over{5}}\right)}\over{2}}-\cos \left({{\pi\,x}\over{5}}\right)$$

and fourier_series(B,L)

$$f_B(x;L) = {{\cos \left(\pi\,x\right)}\over{5}}+{{2\,\cos \left({{4\,\pi\,x}\over{5}}\right)}\over{5}}+{{3\,\cos \left({{3\,\pi\,x}\over{5}}\right)}\over{5}}+{{4\,\cos\left({{2\,\pi\,x}\over{5}}\right)}\over{5}}+\cos \left({{\pi\,x}\over{5}}\right)$$

The ‘vector sum’   gives the expression

$$f_A(x;L) + f_B(x;L) = -{{\cos \left({{7\,\pi\,x}\over{5}}\right)}\over{7}}+{{\cos \left({{6\,\pi\,x}\over{5}}\right)}\over{6}}+{{13\,\cos \left({{4\,\pi\,x}\over{5}}\right)}\over{20}}+{{4\,\cos \left({{3\,\pi\,x}\over{5}}\right)}\over{15}}+{{13\,\cos \left({{2\,\pi\,x}\over{5}}\right)}\over{10}}$$

and the corresponding plot

fourier_vector_plot_A_plus_B

The student can then confirm this in terms of adding the list representations together by executing C = add_list(A,B) which yields

\[ C = \left[0,\frac{13}{10},\frac{4}{15},\frac{13}{20},0,\frac{1}{6},-\frac{1}{7}\right] \; .\]

 

Evaluating $$f_C(x;L)$$ = fourier_series(C;L) which yields the identical expression

$$f_C(x;L) = -{{\cos \left({{7\,\pi\,x}\over{5}}\right)}\over{7}}+{{\cos \left({{6\,\pi\,x}\over{5}}\right)}\over{6}}+{{13\,\cos \left({{4\,\pi\,x}\over{5}}\right)}\over{20}}+{{4\,\cos \left({{3\,\pi\,x}\over{5}}\right)}\over{15}}+{{13\,\cos \left({{2\,\pi\,x}\over{5}}\right)}\over{10}}$$

and the identical plot

fourier_vector_plot_C