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]
4 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:
motikmotik4 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
Add the following vector given in rectangular form and illustrated the process graphically A = 16+j12, B= 6+j10.4
MariettaO [177]

Answer:

A=16+j12…'B=6+j10.4

Explanation:

add the following vector given in

3 0
2 years ago
Moonbeam-Musel (MM), a manufacturer of small appliances, has a large injection molding department. Because MM's CEO, Crosscut Sa
forsale [732]

Answer: Because MM's CEO, Crosscut Sal, is a stickler for keeping machinery running, the company stocks quick-change replacement modules for the two most common ..

Explanation:

7 0
3 years ago
Explain the LWD process why is it important in drilling operations?
barxatty [35]

Answer:

Logging while drilling (LWD) is a technique of conveying well logging tools into the well borehole downhole as part of the bottom hole assembly (BHA). ... In these situations, the LWD measurement ensures that some measurement of the subsurface is captured in the event that wireline operations are not possible.

Explanation:

pls mark brainliest

6 0
3 years ago
A 0.50 m3 drum was filled with 0.49 m3 of liquid water at 25oC and the remaining volume was water vapor without any air. The dru
timurjin [86]

Answer:

There is not going to be pressure build up in the  system,that is isobaric process.

Explanation:

Assumptions to be made

1.  No mass is gained or lost during the heating process.

2. There are no friction losses,so work is transmitted efficiently.

3. It was started the water in the drum and its surrounding have same temperature.

4. This system is closed,so there is no mass transfer across its boundaries.

5 0
3 years ago
A remote village on an island was devastated by a typhoon. Farmland was flooded and the crops
insens350 [35]

Answer:

A flood happens when water overflows or soaks land that is normally dry. flooding, happens when a large storm or tsunami causes the sea to They soon fell ill and died from cholera, which is spread by  Rice, wheat, and corn crops were destroyed.  Excess water overflows and runs on top of the land.

Explanation:

hope this helps

6 0
3 years ago
Other questions:
  • In order to avoid slipping in the shop, your footwear should __
    10·2 answers
  • A piece of corroded steel plate was found in a submerged ocean vessel. It was estimated that the original area of the plate was
    12·1 answer
  • Tranquilizing drugs that inhibit sympathetic nervous system activity often effectively reduce people's subjective experience of
    8·1 answer
  • What is the relationship between orifice diameter and pipe diameter​
    15·1 answer
  • Determine the total condensation rate of water vapor onto the front surface of a vertical plate that is 10 mm high and 1 m in th
    8·2 answers
  • A can of engine oil with a length of 150 mm and a diameter of 100 mm is placed vertically in the trunk of a car. On a hot summer
    8·1 answer
  • The natural material in a borrow pit has a mass unit weight of 110.0 pcf and a water content of 6%, and the specific gravity of
    11·1 answer
  • Engine blocks are made by using a manufacturing process called​
    12·1 answer
  • What are the functions of the peripheral nervous system
    6·2 answers
  • There are three homes being built, each with an identical deck on the back. Each deck is comprised of two separate areas. One ar
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!