Answered step by step
Verified Expert Solution
Question
1 Approved Answer
you should use python. 1. Define the following matrices as numpy arrays 1 2 3 4 5 6 4 2 The matrix product AB between
you should use python.
1. Define the following matrices as numpy arrays 1 2 3 4 5 6 4 2 The matrix product AB between two matrices A and B, implemented as the numpy array's A and B, is given by A.dot (B). Remember that the matrix product is not commutative, so that AB BA. The matrix product BA is given by B.dot (A) Find each of the following matrix products using numpy: BA, AC, CA, and CB 2. Without using the numpy.dot class for array's, implement a function for matrix multi- plication. If A is a [p x q] matrix, and B is an [r x s] matrix, then matrix multiplication is not defined unless q-r. If qr, your function should print the message The matrices have incompatible shapes. and return None Assume then that A is [p q] and B is s]. The product AB will be a P s] matrix. The formula for cij, where C-AB is given by where a, is the ith row of A and b, is the jth column of B. You may want to use the dot product function defined in class to calculate this def DotProduct (V, W): if len (V) len (W) print ("Error: Dot Product: Different Lengths") return sum([x*y for x,y in zip (V, W)1) Demonstrate that program works by calculating (use the same matrices given in exercise 1) BA, AB, AC, CA, and CB, and BC. Where the matrix product is defined, verify that you get the same result you got in exercise 1 3. Let M-0 3 4 Use appropriate functions in numpy. linalg to do the following: (a) Use det to find the determinant of M (b) Use eig and/or eigvals to find the eigenvalues and eigenvectors of M (c) Use inv the inverse of M and dot to demonstrate that MM (d) Use solve to solve the linear systemStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started