A bit of MATLAB, a bit of linear algebra

In summary, this conversation is discussing how to compute vectors P and Q using the MATLAB commands 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), and the results of the summations are 201.0020, -2.4425e-015, 143.8611. P and Q are perpendicular if and only if the dot product of P and Q is zero.
  • #1
Kouheikun
2
0
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):
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 news on Phys.org
  • #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?

Kouheikun said:
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

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.
 
  • #3
The dot product! And if the dot product is zero then the vectors are perpendicular.

Awesome thanks!
 

1. What is MATLAB and how is it used in scientific research?

MATLAB is a programming language and interactive environment commonly used in scientific research. It is primarily used for numerical computations, data analysis, and visualization. It is widely used in fields such as engineering, physics, and mathematics.

2. What is linear algebra and why is it important in scientific research?

Linear algebra is a branch of mathematics that deals with systems of linear equations and their representations in vector spaces. It is important in scientific research because it provides a powerful tool for solving complex problems and analyzing data. It is used in various areas such as machine learning, signal processing, and computer graphics.

3. How does MATLAB incorporate linear algebra in its functions?

MATLAB has built-in functions and tools for performing various linear algebra operations, such as matrix multiplication, eigenvalue and eigenvector calculations, and solving systems of linear equations. It also has a specialized toolbox called the Linear Algebra Toolbox that provides additional functions and algorithms for advanced linear algebra computations.

4. Can MATLAB be used for both basic and advanced linear algebra tasks?

Yes, MATLAB is suitable for both basic and advanced linear algebra tasks. It has a user-friendly interface and simple syntax that makes it easy for beginners to learn and use. At the same time, it also has advanced features and capabilities that can handle complex and large-scale linear algebra problems.

5. Is it necessary to have a strong background in linear algebra to use MATLAB?

No, it is not necessary to have a strong background in linear algebra to use MATLAB. While some knowledge of linear algebra can be helpful, MATLAB has a comprehensive documentation and online resources that can guide users with little or no knowledge of linear algebra in performing various tasks and analyses.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
566
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • Calculus and Beyond Homework Help
Replies
24
Views
793
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
Back
Top