(Algebra: add two matrices) Write a function to add two matrices. The header of the function is: def addMatrix(a, b): In order to be added, the two matrices must have the same dimensions and the same or compatible types of elements. Let c be the resulting matrix. Each element Cij is aj + bj. For example, for two 3 X 3 matrices a and b, c is

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
11.5 Python please
b1 b12 b13
b21 b22
a11 + b1
a21 + b21
a13 + b13
a23 + b23
+ b32
a11
a12
a13
a12 + b12
a21
a22
a23
b23
a22 + b22
a31
a32
a33,
b31 b32 b33/
a31 + b31
Az3 + b33)
az2
Write a test program that prompts the user to enter two 3 X 3 matrices and dis-
plays their sum. Here is a sample run:
Enter matrixl: 1 2 3 45 6 7 8 9
Enter
Enter matrix2: 0 2 4 1 4.5 2.2 1.1 4.3 5.2
- Enter
The matrices are added as follows:
1.0 2.0 3.0
0.0 2.0 4.0
1.0 4.0 11.0
4.0 5.0 6.0
1.0 4.5 2.2
5.0 11.5 8.2
11.0 8.0 11.0
1.1 4.3 5.2
8.1 12.3 14.2
Transcribed Image Text:b1 b12 b13 b21 b22 a11 + b1 a21 + b21 a13 + b13 a23 + b23 + b32 a11 a12 a13 a12 + b12 a21 a22 a23 b23 a22 + b22 a31 a32 a33, b31 b32 b33/ a31 + b31 Az3 + b33) az2 Write a test program that prompts the user to enter two 3 X 3 matrices and dis- plays their sum. Here is a sample run: Enter matrixl: 1 2 3 45 6 7 8 9 Enter Enter matrix2: 0 2 4 1 4.5 2.2 1.1 4.3 5.2 - Enter The matrices are added as follows: 1.0 2.0 3.0 0.0 2.0 4.0 1.0 4.0 11.0 4.0 5.0 6.0 1.0 4.5 2.2 5.0 11.5 8.2 11.0 8.0 11.0 1.1 4.3 5.2 8.1 12.3 14.2
I1.5 (Algebra: add two matrices) Write a function to add two matrices. The header of
the function is:
def addMatrix(a, b):
In order to be added, the two matrices must have the same dimensions and the
same or compatible types of elements. Let c be the resulting matrix. Each element
Cij is a + bij. For example, for two 3 X 3 matrices a and b, c is
Transcribed Image Text:I1.5 (Algebra: add two matrices) Write a function to add two matrices. The header of the function is: def addMatrix(a, b): In order to be added, the two matrices must have the same dimensions and the same or compatible types of elements. Let c be the resulting matrix. Each element Cij is a + bij. For example, for two 3 X 3 matrices a and b, c is
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY