Question: In this question we explore the differences between lists and numpy arrays. First, you will create an m n matrix M filled with numbers 1
In this question we explore the differences between lists and numpy arrays.
First, you will create an matrix filled with numbers dots, in order, by
rows. For example, if and then
if and then
and and
Parts ac: Use commands for lists only no numpy arrays
a Write a function creatematrix to create the matrix as described above.
b Write a function sumcolumnsM to create a list whose entry under index is the
sum of all elements in the column of
c Write a function sumrows to create a list whose entry under index is the sum
of all elements in the row of
Parts df: Use commands for numpy arrays only, such as nparange, npreshape,
sum, etc., as well as slicing. Do not use commands for lists, such as append.
d Write a function npcreatematrix to create the numpy array as de
scribed above.
e Write a function npsumcolumnsM to create a numpy vector ie a onedimensional
array whose entry under index is the sum of all elements in the column of
f Write a function npsumrowsM to create a a numpy vector ie a onedimensional
array whose entry under index is the sum of all elements in the row of
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
