Scientific Computing Using Python - PHYS:4905
    
     Lecture #08 - Prof. Kaaret
    Vectors, linear operators, and vector spaces
    
    These notes borrow from Linear Algebra
    by Cherney, Denton, Thomas, and Waldron.
    
    
    What is a vector?
    A physicist typically thinks of a vector as a way to specify the
      position of an object in a 3 or 2 dimensional space.  There
      are also other vectors that are common in physics.  For
      example, velocity can also be a vector, as can acceleration. 
      What is common about these quantities?
    One property common to all vectors is that they can be added and
      the result is another vector.
    Another common property is that a vector can be multiplied by a
      number, that we'll call a scalar, and that the result is another
      vector.  We'll call this scalar multiplication.
    
    The concept of vector can be generalized.  For example,
      instead of using a basis consisting of unit vectors ,
      let's instead considering a basis consisting of the functions
       defined over
      the interval
      . 
      Instead of specifying a position in space, our vector
      
      will now specify a function 
      defined over that same interval.
      Does this obey the two crucial properties of vectors defined
      above?  Let's check.  First, let's add two vectors,
      
    
    
      We can add the two functions specified by the two vectors and the
      resultant is another function of the same form.  This means
      that we can add the two vectors and the resultant is another
      vector defined in the same basis.  We can also multiply a
      vector by a scalar and the resultant is another vector. 
      Therefore, the family of functions basis using the basis 
       works just like
      vectors representing position in a 3D space.  Linear algebra
      is the study of vector spaces and how linear operators act on
      those spaces.  By generalizing the concept of vector spaces,
      linear algebra becomes a very powerful mathematical tool.
    
    
    
    Vector Spaces
    
    We will be considered vectors with an arbitrarily large number of
    components: n-vectors.
         
    
    
    where the individual components are real numbers,
    , where
    we use
     to denote the
    set of real numbers.  Note that
     means the
    second element of the vector a and not a
    squared.  Also, note that in standard mathematical notion, one
    starts indexing from 1 rather than from zero as in Python.
    
    Vectors exist in a 'vector space'.  The vector space for an n-vector
    is the set of all possible n-vectors that particular n,
    which we can write as
    .
    
     Euclidean Vector Spaces
    
    We will initially be working in vector spaces with Euclidean
    geometry.  This is the geometry that you are familiar with from
    2 and 3 dimensional vectors in physics.  Addition of vectors
    and multiplication of a scalar times a vector work as you
        expect 
      
          
      
    
    We define the dot product of two vectors as
    
         
    
    
    
    We define the Euclidean length of an n-vector as
    
         
    
    
    and we define the angle between two vectors  as
    
         
    
    
    
    The dot product is 
    
    - commutative (or symmetric)  
    
    
    - distributive 
    
    
    - linear in both vectors or bilinear 
    
    
    - and positive definite 
    
    
    This isn't the only possible way to define the dot product.  If
    you've done any special relativity, you might have been introduced
    to a dot product that is not positive definite.  In the
    Lorentzian inner product, the product of the terms in the time
    dimension comes into the sum with a minus sign.  This is
    because space in relativity is not Euclidean.
    
    Hyperplanes
    
    In n-dimensional Euclidean geometry, we have a vector space
     that is
    full of points.  We can use n-vectors to label particular
    points P.  There is a special point, the origin, that
    we label with the 0 vector, which has all of its elements
    equal to zero.  The zero vector is the only vector with zero
    length and no direction.
    
    We can describe a line in
     in
    terms of two vectors, a and b, as the set of
    points 
     
    
    We can describe a plane in
     in
    terms of three vectors, a, b, and c, 
    as the set of points   
    
    We can keep going and describe a hyperplane with k vectors a1
    ... ak  where  as the
    set of points 
    
    
    where we have replaced the vector pointing to a position with the
    point P at that position.
    
    
    General Vector Spaces
    
    The vector spaces
     
    are very nice vector spaces, but they are not the only
    possibilities.  We could, for instance, consider the space of
    functions of one real variable.  One such function is y
    = x, another is y = 3x2, another
    is y = sin(2x).  Each point in this space
    represents a function.  We need an infinite number of numbers
    to specify every possible function, so the space is
    . 
    Note that the common operations that we use on vectors still
    work.  
    
    For example, we can add two functions f and g,
    
    
    Addition in this vector space means starting at one vector, adding
    another vector, and ending up at a final vector.  It works just
    like vector additional in a Euclidean space, but the points in the
    space represent different functions.
    
    This space also has a zero, defined as f(x) =
    0.  If we add the zero function to another function, we get
    back our original function.  This is exactly the same as adding
    the zero vector.
    
    Our more fancy vector spaces still need to follow a bunch of rules.
    
      - Closure under addition - adding two vectors in the space gives
        another vector in the space.
 
      - Addition is commutative - the order of addition doesn't
        matter.
 
      - Addition is associative - when adding multiple vectors, the
        order doesn't matter.
 
      - Zero - there is a zero such that adding it to any vector in
        the space leaves the vector unchanged.
 
      - Additive inverse - for any vector in the space, there is
        another vector such that the sum of the two vectors is zero. 
 
      - Closure under scalar multiplication - multiplying any vector
        in the space by a scalar produces another vector in the space.
 
      - Multiplication is distributive over scalars and vectors.
 
      - Scalar multiplication is associative.
 
      - Unity - multiplying a vector times unity gives back the same
        vector.
 
    
    
    We showed above that the space of functions of one real variable is
    a vector space.  How about the space of differentiable
    functions of one real variable?
    
    Is the sum of two differentiable functions another differentiable
    function?
    
    Is the product of a scaler times a differentiable functions another
    differentiable function?
    
    What is the zero of this vector space?
    
    
    Fields (of Corn)
    
    We have defined our vector spaces over the real numbers.  In
    this context, the real numbers would be called the field or
    the base field or the baseball field, (well,
    maybe not that last one.)   We could instead use a
    different field.  In quantum mechanics, we use vector spaces to
    define the possible states of a physical system.  For example,
    we might have an electron that can have its spin up, represented by
    , 
    and its spin down, represented by
    . 
    In a classical description of the electron, one would have some
    probability (a positive definite real number) that the electron is
    in the spin up state and a probability that the electron is in the
    spin down state.  It would be nice if the two probabilities add
    to one, so that the electron is in one state or the other.
    
    A very interesting aspect of quantum mechanics is that probabilities
    alone aren't good enough.  We need to have a probability
    amplitude of the electron being in the spin up state and another
    probability amplitude that it is in the spin down state.  One
    finds the probability on the electron being in a state by taking the
    modulus squared of the corresponding amplitude (and, again, it is
    nice if the probabilities add to one).  However, complex
    amplitudes allow description of phenomena like interference.
    
    
    Assignment
    We're back to programming for HW #8.