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
Convert the unit Decimeter (dm) into Micrometer (um).
oksian1 [2.3K]

Answer:

86701 Micrometers.

Explanation:

Multiply 0.86701 dm by 100,000 to get 86701 um.

7 0
3 years ago
What's a disadvantage of highest MERV-rated filters?
Arte-miy333 [17]

Answer:

3) the pressure drop across high MERV filters is significant.

Explanation:

MERV (Minimum-Efficiency Reporting Value) is used to measure the efficiency of filter to remove particles. A filter of high MERV can filter smaller particles but this causes an increase in reduced air flow that is an increase in pressure drop. High MERV filters capture more particles causing them to get congested faster and thereby increasing pressure drop.

Excessive pressure drop can cause overheating and lead to damage of the filter. The pressure drop can be reduced by increasing the surface area of the filter.

3 0
3 years ago
Read 2 more answers
True/False
sweet [91]

Answer:

false jdbebheuwowjwjsisidhhdd

7 0
3 years ago
The dam cross section is an equilateral triangle, with a side length, L, of 50 m. Its width into the paper, b, is 100 m. The dam
lisabon 2012 [21]

Answer:

Explanation:

In an equilateral trinagle the center of mass is at 1/3 of the height and horizontally centered.

We can consider that the weigth applies a torque of T = W*b/2 on the right corner, being W the weight and b the base of the triangle.

The weigth depends on the size and specific gravity.

W = 1/2 * b * h * L * SG

Then

Teq = 1/2 * b * h * L * SG * b / 2

Teq = 1/4 * b^2 * h * L * SG

The water would apply a torque of elements of pressure integrated over the area and multiplied by the height at which they are apllied:

T1 = \int\limits^h_0 {p(y) * sin(30) * L * (h-y)} \, dy

The term sin(30) is because of the slope of the wall

The pressure of water is:

p(y) = SGw * (h - y)

Then:

T1 = \int\limits^h_0 {SGw * (h-y) * sin(30) * L * (h-y)} \, dy

T1 = \int\limits^h_0 {SGw * sin(30) * L * (h-y)^2} \, dy

T1 = SGw * sin(30) * L * \int\limits^h_0 {(h-y)^2} \, dy

T1 = SGw * sin(30) * L * \int\limits^h_0 {(h-y)^2} \, dy

T1 = SGw * sin(30) * L * \int\limits^h_0 {h^2 - 2*h*y + y^2} \, dy

T1 = SGw * sin(30) * L * (h^2*y - h*y^2 + 1/3*y^3)(evaluated between 0 and h)

T1 = SGw * sin(30) * L * (h^2*h - h*h^2 + 1/3*h^3)

T1 = SGw * sin(30) * L * (h^3 - h^3 + 1/3*h^3)

T1 = 1/3 * SGw * sin(30) * L * h^3

To remain stable the equilibrant torque (Teq) must be of larger magnitude than the water pressure torque (T1)

1/4 * b^2 * h * L * SG > 1/3 * SGw * sin(30) * L * h^3

In an equilateral triangle h = b * cos(30)

1/4 * b^3 * cos(30) * L * SG  > 1/3 * SGw * sin(30) * L * b^3 * (cos(30))^3

SG > SGw * 4/3* sin(30) * (cos(30))^2

SG > 1/2 * SGw

For the dam to hold, it should have a specific gravity of at leas half the specific gravity of water.

This is avergae specific gravity, including holes.

6 0
3 years ago
What is a microwave transmitter?a) A technology that uses active or passive tags in the form of chips or smart labels that can s
Blababa [14]

Answer:

b) Commonly used to transmit network signals over great distances.

Explanation:

The transmission of information or data by using microwave radio waves is known as microwave transmission. Microwave transmitter is commonly used to transmit network signals over great distances. It is an electronic device that transmits and receives radio frequency signals ranging from 1GHz to 100GHz.

The microwave transmitter has a wide range of applications and these includes, radio stations, television stations, mobile phones, radio astronomy, radar,

5 0
3 years ago
Read 2 more answers
Other questions:
  • Air is compressed adiabatically from p1 1 bar, T1 300 K to p2 15 bar, v2 0.1227 m3 /kg. The air is then cooled at constant volum
    13·1 answer
  • A PMOS device with VT P = −1.2 V has a drain current iD = 0.5 mA when vSG = 3 V and vSD = 5 V. Calculate the drain current when:
    12·1 answer
  • A six-lane freeway (three lanes in each direction) currently operates at maximum LOS C conditions. The lanes are 11 ft wide, the
    5·1 answer
  • 1. Which type of fit implies that a piece will never fit? a. interference fit b. construction fit c. transition fit d. impeding
    8·1 answer
  • Write down the equation for the stoichiometric combustion of propane (C3H8).
    6·1 answer
  • An engineer is designing a total hip implant. She intends to make the femoral stem out of titanium because it forms a good inter
    12·1 answer
  • Under EPA's regulations, which of the following methods can be used to pressurize an R11 or R123 system for the purpose of openi
    11·1 answer
  • A three-point bending test is performed on a glass specimen having a rectangular cross section of height 5.3 mm and width 11.6 m
    11·1 answer
  • There are some sections of the SDS that are not mandatory.
    11·1 answer
  • What is required when setting up a smart phone as a WIFI hotspot?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!