Choosing a programming language as a competitive tool

Sheila King sheila at spamcop.net
Mon May 7 01:37:44 EDT 2001


On Sun, 6 May 2001 21:36:14 -0600, "Andrew Dalke" <dalke at acm.org> wrote in
comp.lang.python in article <9d55e1$qel$1 at slb1.atl.mindspring.net>:

:Please, not "vector"!  A vector is a measurement with a direction
:and a magnitude, as with velocity or force.  Or it's a
:coordinate in some space.  When I came across "vector" as
:used in computer science I was confused because I thought it
:was a way to do vector math.  Even now I still have to look
:twice at a library to figure out which use is which.

That's only in physics and engineering.

In mathematics, a vector is an element in a vector space (or linear space),
which is a set having the following properties:

under some addition operation for all elements in the set, and a multiplication
operation for a scalar (real number) times an element in the set, we have,
for x, y in the set and for any arbitrary b, and c in the Reals:

x + y = y + x
(x + y) + z = x + ( y + z)
there is a zero vector, 0, such that x + 0 = x
c(x + y)= cx+cy
(b+c)x = bx + cx
b(cx) = (bc)x
0x = 0
and for some identity element in the set, 1, we have
1x=x

Any set having all of these properties is a vector space (or linear space), and
each element in the space is  a vector.

An example is the set of ordered pairs, (x,y) where x and y are elements of the
real numbers.

Maybe a better example, though, instead of listing all these properties, would
be to simply remind you of matrix multiplication.

Something like this:

A = [2 1
     3 -4]

so A is a 2 by 2 matrix

B = [0
     4]

So B is a 2 by 1 matrix

AB = [4
      -16]

Matrices like B and AB, which look like columns are often called "column
vectors". This is the type of vector, I believe, that we are referring to when
we refer to "lists" as "vectors" in computer science.

When I teach a vector class to my C++ high school students, I tell them that it
has nothing to do with the vectors that they learned about in physics, and there
is an audible sigh in the room. I have shown them the matrix multiplication, and
told them that the n by 1 matrices are called column vectors, and the 1 by n
matrices are often called row vectors. I encourage them to think of vectors that
way.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/





More information about the Python-list mailing list