Matrix addition and subtraction (p. We can use the numpy. add and numpy.subtract functions to add and subtract atrices in Python as in the following code, which follows from the preceding code: # Add A and B print (numpy. add (A, B)) # Subtract A and B print (numpy.subtract (A,B)) 122 Computational Algorithms in Linear Algebra The code has the following output: [[ 4 3 3] [17 4 2] [ 3 4 411 [[ 2 1 -1] [ 1-4 0] [ 3 4 -2]] Of course, this is in fact A + B and A- B, which we could find by hand if we add and subtract all the numbers in the matrices element by element. Next, we continue with more arithmetic of matrices: multiplying a whole matrix by a scalar (or, by a number).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
Details are in the pictures
Matrix addition and subtraction (p. 121-122)
We can use the numpy. add and numpy. subtract functions to add and subtract
atrices in Python as in the following code, which follows from the preceding code:
#Add A and B
print (numpy. add (A, B) )
# Subtract A and B
print (numpy.subtract (A,B))
122 Computational Algorithms in Linear Algebra
The code has the following output:
[[ 4 3 3]
[17
4 2]
[ 3
4 4]]
[[ 2
1 -1]
[ 1 -4 0]
[ 3 4 -2]]
Of course, this is in fact A + B and A- B, which we could find by hand if we add and
subtract all the numbers in the matrices element by element.
Next, we continue with more arithmetic of matrices: multiplying a whole matrix by
a scalar (or, by a number).
Transcribed Image Text:Matrix addition and subtraction (p. 121-122) We can use the numpy. add and numpy. subtract functions to add and subtract atrices in Python as in the following code, which follows from the preceding code: #Add A and B print (numpy. add (A, B) ) # Subtract A and B print (numpy.subtract (A,B)) 122 Computational Algorithms in Linear Algebra The code has the following output: [[ 4 3 3] [17 4 2] [ 3 4 4]] [[ 2 1 -1] [ 1 -4 0] [ 3 4 -2]] Of course, this is in fact A + B and A- B, which we could find by hand if we add and subtract all the numbers in the matrices element by element. Next, we continue with more arithmetic of matrices: multiplying a whole matrix by a scalar (or, by a number).
Perform the following tutorial-style labs, taken from our supplementary textbook,
using the programming language python. You do not need to have python on your
computer. Please use the following online editor and interpreter:
https://www.online-python.com/
Just enter the code as shown, run, and view the results. In addition, you will be
given one exercise of your own to do, based directly on the given examples (thus
little to no original programming is required to do the exercise). These labs are not
intended to be python programming labs - you do not need to have prior
knowledge of python, although some prior knowledge of C-style language may be
helpful. The point is to gain some experience using linear algebra to solve
problems on your computer, not to teach computer programming. Any
modifications to the code you are given will be minor, and should not cause any
problems for someone with a background in C.
Please take screenshots of all your resulting output, on your screen as it appears in
the above online interpreter. Submit these screenshots and your code on
Blackboard. Also answer any additional problems you are given.
Transcribed Image Text:Perform the following tutorial-style labs, taken from our supplementary textbook, using the programming language python. You do not need to have python on your computer. Please use the following online editor and interpreter: https://www.online-python.com/ Just enter the code as shown, run, and view the results. In addition, you will be given one exercise of your own to do, based directly on the given examples (thus little to no original programming is required to do the exercise). These labs are not intended to be python programming labs - you do not need to have prior knowledge of python, although some prior knowledge of C-style language may be helpful. The point is to gain some experience using linear algebra to solve problems on your computer, not to teach computer programming. Any modifications to the code you are given will be minor, and should not cause any problems for someone with a background in C. Please take screenshots of all your resulting output, on your screen as it appears in the above online interpreter. Submit these screenshots and your code on Blackboard. Also answer any additional problems you are given.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education