1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A bit of MATLAB, a bit of linear algebra

  1. Feb 6, 2006 #1
    I'm taking a course on numerical methods using MATLAB, and right now we're discussing linear systems. This is the question I was given.

    P(x) = (3/2)x^2 - 1/2
    Q(x) = (5/2)x^3 - (3/2)x

    Compute vectors P and Q using the following MATLAB commands.

    X = -1:1/500:1;
    N = length(X);
    P = p(1)*X.^2 + p(2)*X + p(3)*1;
    Q = q(1)*X.^3 + q(2)*X.^2 + q(3)*X + q(4);

    Where p and q are the coefficient vectors of the polynomials P(x) and Q(x).

    Compute and give the numerical result for:

    (The sum from i=1 to N) of (Pi Pi)
    (The sum from i=1 to N) of (Pi Qi)
    (The sum from i=1 to N) of (Qi Qi)

    What linear algebra operation is this? Express your answer in vector notation.

    Based on the results of the above summations, what can we infer about P and Q and why?

    I'm fine all the way up to the linear algebra questions.

    I understand that X is a vector containing 1001 evenly spaced numbers between -1 and 1, and so vectors P and Q are vectors containing 1001 values of the functions P(x) and Q(x) respectively within the range x=-1 to x=1.

    As for the summations, I'm using sum(P.*P) and the like to get these three sums (in order):

    So what linear algebra operation is this? I first thought of integration, since it's a summation of a function across a range of x values, but that's not linear algebra. I don't ever recall individual squaring the entries of a vector in first year lin alg. The statement "express your answer in vector notation" suggests that the three sums make up a notable 3x1 vector, but again, I'm completely at a loss.

    Did I do the summation wrong, or do I just need to brush up on linear algebra? Help!
  2. jcsd
  3. Feb 6, 2006 #2
    If P and Q were 3 dimensional vectors living in x-y-z space, such that P = [Px Py Pz] and Q = [Qx Qy Qz], then sum(Pi*Qi) = PxQx + PyQy + PzQz

    Does that look like any linear algebra operation that you know?

    This says that P is not zero and Q is not zero, but this operation on P and Q is zero. When you figure out the operation, the fact that sum(Pi*Qi) gives zero should tell you something about those two vectors.
  4. Feb 6, 2006 #3
    The dot product! And if the dot product is zero then the vectors are perpendicular.

    Awesome thanks!
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: A bit of MATLAB, a bit of linear algebra