103_1_TomsHandouts

103_1_TomsHandouts - Discussion 2 EE 103 October 5 2010 EE 103 Discussion 2 Review • You can multiply two matrices A and B provided their

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Discussion 2 EE 103 October 5, 2010 EE 103 - Discussion 2 Review • You can multiply two matrices A and B provided their dimensions are compatible, which means the number of columns of A equals the number of rows of B . Suppose A and B are compatible, e.g., A has size m × p and B has size p × n . Then the product matrix C = AB is the m × n matrix with elements c ij = p X k =1 a ak b kj = a i 1 b 1 j + ··· + a ip b pj . • The cost of a matrix algorithm is often expressed by giving the total number of flops required to carry it out. One flop is defined as one ad- dition, subtraction, multiplication, or division of two floating-point numbers. To evaluate the complexity of an algorithm, we count the total number of flops, express it as a function of the dimensions of the matrices and vectors involved, and simplify by only keeping the leading terms. 1. (2.3) Shift Matrices. a. Give a simple description in words of the function f ( x ) = Ax , where A is the 5 × 5 matrix A = 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 . b. Same question for f ( x ) = A k x , for k = 2 , 3 , 4 , 5 . ( A k is the k th power of A : A 2 = AA , A 3 = A 2 A = AAA , etc.) c. Same question for f ( x ) = A T x . 2. Exercise from 2-25. Evaluate y = ABx two ways ( A and B are n × n , x is a vector). 1 Discussion 2 EE 103 a. y = ( AB ) x . Coded in Matlab as: C = A * B; y=C * x; b. y = A ( Bx ) . Coded in Matlab as: z = B * x; y=A * z; Both methods give the same answer, but which method is faster? 3. (4.1) Polynomial interpolation. In this problem we construct polynomials p ( t ) = x 1 + x 2 t + ··· + x n- 1 t n- 2 + x n t n- 1 of degree 5, 10, and 15 (i.e., for n = 6 , 11 , 16 ), that interpolate the function f ( t ) = 1 / (1 + 25 t 2 ) over the interval [- 1 , 1] . For each value of n , we com- pute the interpolating polynomial as follows. We first generate n + 1 pairs ( t i ,y i ) , using the Matlab commands t = linspace(-1,1,n)’; y = 1./(1+25 * t.ˆ2); This produces two vectors: a vector t with n elements t i , equally spaced in the interval [- 1 , 1] , and a vector y with elements y i = f ( t i ) . We then solve a set of linear equations 1 t 1 ··· t n- 2 1 t n- 1 1 1 t 2 ··· t n- 2 2 t n- 1 2 . . . . . . . . . . . . 1 t n- 1 ··· t n- 2 n- 1 t n- 1 n- 1 1 t n ··· t n- 2 n t n- 1 n x 1 x 2 . . . x n- 1 x n = y 1 y 2 . . . y n- 1 y n to find the coefficients x i . Calculate the three polynomials (for n = 6 ,n = 11 ,n = 16 ). Plot the three polynomials and the function f on the interval [- 1 , 1] . What do your con- clude about the effect of increasing the degree of the interpolating polyno- mial?...
View Full Document

This note was uploaded on 02/03/2011 for the course EE 103 taught by Professor Vandenberghe,lieven during the Spring '08 term at UCLA.

Page1 / 18

103_1_TomsHandouts - Discussion 2 EE 103 October 5 2010 EE 103 Discussion 2 Review • You can multiply two matrices A and B provided their

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online