MATLAB Exercise School of mathematical Sciences xiamen univers http:/edjpkc.xmu.ed MATLAB Exercise 6- Polynomial 1. Generate the following polynomials as row vectors 1)f 3)f l)(x+3) 3x+4 2. Represent polynomial f=(x-1)(x-2)(x-3)in the following forms D)row vector 3)pretty 3. Evaluate the polynomial f=(x-1(x-2)(x-3)at 4. Execute following codes compare the results and the difference between subs and polyvalm Why? Here eye(2)means[10; 01 1)>>syms x; mat==eye(2): sym pol a=x 2+1; subs( sym pol a, mat) 2)>> clear; mat=eye(2); pol a=[10 1] polyvalm(pol a, mat) 3)replace the code pol a=[10 1 with syms x; pol a=x 2+I in 2). How about the result? Why? How to correct it if pol a=x 2+l should be used? 5.Letf(x=x+x-4,g(x)=2x+1.compute 1)f(x)+g(x) 2)f(x)g(x)3)f(g) Help In command window input help conv(or decon), learn the different usage of this function 6. Let f(x)=x, g(x)=3x+l Compute following formula by two different methods(i.e operations of matrix operations of sym objects) 1)f(x)+g(x) 2)f(x)g(x) 7. Please display the result of Ex6 1)sym form and the terms ordered by descending powers 2)as row vector 8. Generate matrices which are 1)a symmetric positive definite matrix 2) a symmetric positive semi-definite matrix and check the matrices by roots function and operation. 9. Compute the quotient and remainder of and display the results in sym form, where f(x)=x3+2x2-3x3-x2-2x+3,g(x)=x2+x2-5x2-6 Ex6-1
MATLAB Exercise 6 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Ex61 MATLAB Exercise 6 – Polynomial 1. Generate the following polynomials as row vectors 1) 5 f = x + 3x - 4 2) 3 f = x 3) f = x(x -1)(x + 3) 4) 1 2 3 4 x x - + 2. Represent polynomial f = (x -1)(x - 2)(x -3) in the following forms 1) row vector 2) sym 3) pretty 4) 3. Evaluate the polynomial f = (x -1)(x - 2)(x -3) at 1) point 4 2) point 1 to 10 4. Execute following codes compare the results and the difference between subs and polyvalm. Why? Here eye(2) means [1 0; 0 1] 1) >> syms x; mat = eye (2); sym_pol_a = x^2+1; subs(sym_pol_a, mat) 2) >> clear; mat = eye (2); pol_a = [1 0 1]; polyvalm(pol_a, mat) 3) replace the code pol_a = [1 0 1] with syms x; pol_a = x^2+1 in 2). How about the result? Why? How to correct it if pol_a = x^2+1 should be used? 5. Let 2 f (x) = x + x - 4, 2 g(x) = 2x +1. Compute 1) f (x) + g(x) 2) f (x)g(x) 3) f (g) 4) ( ) ( ) f x g x Help In command window input help conv(or deconv), learn the different usage of this function 6. Let 2 f (x) = x , 5 g(x) = 3x +1. Compute following formula by two different methods (i.e. operations of matrix & operations of sym objects). 1) f (x) + g(x) 2) f (x)g(x) 7. Please display the result of Ex6 1) sym form and the terms ordered by descending powers 2) as row vector 8. Generate matrices which are 1) a symmetric positive definite matrix 2) a symmetric positive semidefinite matrix and check the matrices by roots function and ‘ operation. 9. Compute the quotient and remainder of ( ) ( ) f x g x and display the results in sym form, where 5 4 3 2 f (x) = x + 2x -3x - x - 2x + 3, 4 3 2 g(x) = x + x - 5x - 6
MatlabExercise6SchoolofMathematicalSciencesXiamenUniversityhttp:/gdjpkc.xmu.edu.cn 10.* Try to compute the greatest common factor(最大公因式)off(x)andg(x)inEx9
MATLAB Exercise 6 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Ex62 10. *Try to compute the greatest common factor (最大公因式) of f (x) and g(x) in Ex9