Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 3 (6 points) In this exercise you will be given a set of polynomials P. You will determine whether it is a basis for

Exercise 3 (6 points) In this exercise you will be given a set of polynomials P. You will determine whether it is a basis for the corresponding space of the polynomials. This could be done by using the isomorphism between a linear space of polynomials and degree n, for the corresponding n. If B, which is a matrix of E-coordinates of the polynomials in P, is a basis, your function will (1) find a vector y of the P-coordinates of the polynomial Q (originally Q is written through the standard basis); and (2) write a given polynomial R through the standard basis if the vector r of its P-coordinates is the given.

**First, you should create the following function in MATLAB that will help you to run the code and also will be used later for a presentation of a matrix with some entries that are very close to 0:

function B=closetozeroroundoff(A)

[m,n]=size(A);

for i=1:m

for j=1:n

if abs(A(i,j))<10^(-7)

A(i,j) = 0;

end

end

end

B=A;

**Then, you will create a

function B=polyspace(P,Q,r)

where P=[P(1),...,P(n)] is a vector whose components are polynomials from the space Pn-1 a set of polynomials of degree at most (n-1) written through by the standard basis

E={xn-1,...,x,1} (in descending order according to the degree), Q is a single polynomial from the same space Pn-1, and r is a vector with n components.

Note on the form of a polynomial: for purpose of this program, it is required that the coefficient at the degree xn-1 must not be zero. However, the zero coefficient is accepted by the definition of the space Pn-1 and some given polynomials do not have term xn-1, that is, the coefficient is zero at xn-1. Being able to work with such polynomials, we insert the coefficient 10^(-8) at xn-1 and it will be converted into a 0 after you run the function closetozeroroundoff in your code.

**You should begin writing the function polyspace with the commands:

format rat,

u=sym2poly(P(1));

n=length(u);

The command sym2poly(P(1)) takes the coefficients of the polynomial P(1) (in the descending order according to the degree) and writes them as a row vector (a 1xn matrix). Number n is the dimension of the vector space Pn-1, thus, Pn-1 is isomorphic to the Euclidean space degree n. The number n will be used later in this program.

**To use the isomorphism, you will create an nxn matrix C, whose columns are the vectors of coefficients of the polynomials in the set P, and then convert to 0 the entries that are close to zero. The output matrix for this part is B. Here is a suggested code

C=zeros(n);

for i=1: n

C( : , i) = transpose(sym2poly(P(i)));

end

B=closetozeroroundoff(C);

Then you will check if B is a basis for degree n- I suggest the command rank.

If B is not a basis, the program has to terminate and produce the reduced echelon form of the matrix B.

% Having the reduced echelon form of the matrix B, you will make a comment explaining the reason why P is not a basis for degree n (put the comment in your diary file). In this case, the set of polynomials P does not form a basis for Pn-1 either (a consequence of the isomorphism from Pn-1 onto degree n).

The set of commands that outputs the results for this part may have a form:

sprintf(the polynomials in P do not form a basis for P%d,n-1)

fprintf(the reduced echelon form of B is % \ n)

A=rref(B)

return

**If B is a basis, create a message indicating that the polynomials in P form a basis for the corresponding space of the polynomials, and your function will continue with two more tasks:

(1) Find a row vector y of P-coordinates of the polynomial Q. Your output for this part should contain a message and the row vector y. It could have a form:

fprintf(the coordinates of the polynomial Q with respect to the basis P are % \ n)

y = closetozeroroundoff(y)

(2) Find the coordinates of the polynomial R with respect to the standard basis, whose P-coordinates is the given vector r. The outputs have to be a message similar to the one above and the polynomial R written through the standard basis E by using the coordinates that you have found as coefficients. Use the command poly2sym applied to the row vector of the coefficients to get the polynomial R in the required form.

**Type the functions closetozeroroundoff and polyspace in your diary file.

**Then type:

x=sym(x);

The last command will allow you to type the polynomials in the variable x in usual way. For example, you will type a polynomial Q=x3+3x2-1 in MATLAB command window as Q=x^3+3*x^2-1. If you do not put semicolon at the end of the line and hit enter, you will see the polynomial that you have typed

.

**Run the function B=polyspace(P,Q,r) for each of the sets of the variables below.

Please make sure that you will type single polynomials as it is indicated above. The set P of polynomials has to be typed as a row vector whose components are the polynomials in P separated by comma.

For example, P=[x^3+3*x^2, 10^(-8)*x^3+x, 10^(-8)*x^3+4*x^2+x, x^3+x].

This set will be the one in (a) which you will test on a basis for P3 .

(a) P={x3+3x2,10-8x3+x,10-8x3,4x4+x,x3+x},

Q(x)=10-8x3+x2+6x, r=[2;-3;1;0] .

(b) P={x3-1,10-8x3+2x2,10-8x3+x,x3+x}, Q and r are the same as in (a).

(c) P={x4+x3+x2+1,10-8x4+x3+x2+x+1,10-8x4+x2+x+1,10-8x4+x+1,10-8x4+1}

Q(x)=x4-1, r=diag(magic(5))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions