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.(adsbygoogle = window.adsbygoogle || []).push({});

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):

201.0020

-2.4425e-015

143.8611

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!

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

**Physics Forums | Science Articles, Homework Help, Discussion**