Linear Algebra: More operations on vectors

Chris Catalfo bio photo By Chris Catalfo Comment

If you didn’t read the first post in this series, you might want to read that first.

Last time we talked about adding vectors:

listA + listB = [1+10,2+11,3+12,4+13] = [11,13,15,17]

or, with fancy math typesetting:

One thing we might like to do with vectors is change all of the elements by some specified amount via multiplication. Multiply them all by 2, for example.

In pretend linear algebra style Python:

listA = 2*[2,4,6,8] 
# listA = [4,8,12,16]

This multiplies every element in the list by a given number.