Question: ( Algebra: add two matrices ) Write a function to add two matrices. The header of the function is: def addMatrix ( a , b
Algebra: add two matrices
Write a function to add two matrices. The header of the function is:
def addMatrixa b:
In order to be added, the two matrices
and
must have the same dimensions and the same or compatible types of elements. Let
be the resulting matrix. Each element
is equal to
For example, for two by matrices and
and
is:
Write a test program that prompts the user to enter two matrices and displays their sum. The numbers in each matrix are entered in one line. Here is a sample run:
Sample Run
Enter matrix:
Enter matrix:
The matrices are added as follows:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
