diff -r 44f06ae0d957 -r d9507624eb8f matrices/questions.rst --- a/matrices/questions.rst Mon Oct 11 11:40:43 2010 +0530 +++ b/matrices/questions.rst Mon Oct 11 12:49:08 2010 +0530 @@ -3,6 +3,82 @@ .. A mininum of 8 questions here (along with answers) +1. ``matrix(A) * matrix(B)`` and ``array(A) * array(B)`` are the same. + + a. True + #. False + +Answer: False + +2. ``matrix(A) * array(B)`` does, + + a. Element wise multiplication. + #. Matrix multiplication. + #. Cannot multiply a matrix object and array object. + #. Depends on the shape of A and B, if compatible matrix + multiplication will be done, otherwise element wise + multiplication. + +Answer: Matrix multiplication + +3. A and B are two matrix objects. Element wise multiplication in + matrices are done by, + + a. A * B + #. ``multiply(A, B)`` + #. ``dot(A, B)`` + #. ``element_multiply(A,B)`` + +Answer: multiply(A, B) + +4. ``norm(A)`` method determines the, + + a. Frobenius norm + #. Infinity norm + #. Induced norm + #. Schatten norm + +Answer: Frobenius norm + +5. ``eig(A)[1]`` and ``eigvals(A)`` are the same. + + a. True + #. False + +Answer: False + +6. The code snippet will work without an error, + :: + + A = matrix([[1, 2, 3, 4], [5, 6, 7, 8]]) + inv(A) + + a. True + #. False + +Answer: False + +7. What is the output of the following code, + :: + + x = matrix([[1, 2, 3], ['a', 2, 'c']]) + identity(x.shape) + + a. Will create an identity matrix of shape (2, 3). + #. ``identity()`` function takes an integer as argument and a tuple + is passed. + #. Will return, matrix([[1,0,1],[0,1,0]]) + #. Will return, matrix([[0,1,0],[0,1,0]]) + +Answer: ``identity()`` function takes an integer as argument and a + tuple is passed. + +8. ``norm(A,ord='fro')`` is the same as ``norm(A)`` + + a. True + #. False + +Answer: True Larger Questions ---------------- @@ -30,3 +106,11 @@ What will be the array after 22 such operations starting with [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +2. Find the infinity norm and the determinant of the inverse of the + product of matrices A and B. + :: + + A = [[ 1, 2, 3, 4], B = [[16, 15, 14, 13], + [ 5, 6, 7, 8], [12, 11, 10, 9], + [ 9, 10, 11, 12], [ 8, 7, 6, 5], + [13, 14, 15, 16]] [ 4, 3, 2, 1]]