1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
NeX [460]
3 years ago
8

In this this problem you will be using for loops to take a matrix of random number and create a new matrix that is the same as t

he random matrix, but with zeros on the diagonal. a) Create matrix m that is a 10x10 matrix of random whole numbers from 1 to 20. You will have to manipulate the random number generator function to modify the interval and get only whole numbers. b) Create a for loop that runs for index i equal to the index for every row in the matrix. Next, create a nested for loop that runs for index j equal to the index for every column in the matrix. This is very similar to the Your Turn - Extra slide of Lecture 13. c) Now, we want to use our for loops to create a new niatrix, n, that is equal to matrix m, but with zeros on the diagonal. You should use an if/else statement to create this new matrix. If the location is on the diagonal (i=j), then the value of matrix n at the location will be zero. Otherwise, the value of matrix n equals the value of matrix m at each location
Engineering
1 answer:
motikmotik3 years ago
5 0

Answer:

import numpy as np

# creating matrix of order 10*10 with random numbers between 1 and 20

m = np.random.randint(1,20, size=(10,10))

# create new matrix which reads matrix m and produces zero along the diagonal

n = np.random.randint(1,20, size=(10,10)) # create new matrix, n

for i in range(0,10): # loop through row of matrix

 for j in range(0,10): # loop through column of the matrix

   if i==j: # check for the diagonal element

     n[i][j] = 0 # asign diagonal value to zero

   else:

     n[i][j] = m[i][j] # assign the value of matrix m to n

# displaying m and n matrix in the given format using disp function

from io import StringIO

buf = StringIO()

np.disp(m,device=buf)

m = buf.getvalue()

m = m[1:-1] #removing the extra [ and ]from beginning and end

print("m = ")

print(m.replace(" [","").replace('[',"").replace(']',""))

buf = StringIO()

np.disp(n,device=buf)

n = buf.getvalue()

n = n[1:-1] #removing the extra [ and ]from beginning and end

print("n = ")

print(n.replace(" [","").replace('[',"").replace(']',""))

Explanation:

You might be interested in
50 points
Burka [1]

Answer:

Water vapor

Explanation:

When water is in a vapor it tends to rise to a higher point. Because of this it would be able to reach the top of a building.

4 0
3 years ago
If an object has the same number of positive and negative charges, its electrical charge is
N76 [4]

When an object has the same number of positive and negative charges, its electrical charge will become neutral.

What is an electric charge?

When the matter is put in an electromagnetic field, it has an electric charge, which causes it to experience a force. A positive or negative electric charge can exist.

Now when the two equal magnitude charges with opposite natures come together they become neutral.

To know more about charges follow

brainly.com/question/24391667

#SPJ4

7 0
2 years ago
LUNES MARTES MIÉRCOLES JUEVES VIERNES SÁBADO DOMINGO
scZoUnD [109]

Answer:

si

Explanation:

8 0
3 years ago
Design for human-fit strategies include:
andreev551 [17]

Answer:

B- extreme fit, close fit, adjustable fit

Explanation:

A human-fit design typically involves the process of manufacturing or producing products (tools) that are easy to use by the end users. Therefore, human-fit designs mainly deals with creating ideas that makes the use of a particular product comfortable and convenient for the end users.

The design for human-fit strategies include; extreme fit, close fit and adjustable fit.

Hence, when the aforementioned strategies are properly integrated into a design process, it helps to ensure the ease of use of products and guarantees comfort for the end users.

5 0
2 years ago
How is the difference between science and engineering Best stated?
stiv31 [10]

Answer:Science is the body of knowledge that explores the physical and natural world. Engineering is the application of knowledge in order to design, build and maintain a product or a process

Explanation:

8 0
2 years ago
Other questions:
  • Data becomes information when it is__________ in some way and made___________
    5·1 answer
  • Kjhwe ,kenwif ujwfeowlwfwfwfw...
    14·2 answers
  • ________ is the amount of time it takes a person’s eyes to regain focus after seeing glare.
    8·2 answers
  • What is the chord length of an airplane called?
    14·1 answer
  • When could you use the engineering design process in your own life?
    9·1 answer
  • Cual es el costo del kwh
    8·1 answer
  • Puan puan puan vericim
    5·2 answers
  • A continuously variable transmission:
    13·1 answer
  • A tool used to put a concave edge on a plane iron is
    6·1 answer
  • A pipe fitter would fabricate which one of the following systems?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!