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
Select the parameters that are included in a baseline performance check. you may select more than one. select one or more: a. co
pishuonlain [190]

Answer:

A F E C D B

Explanation:

6 0
3 years ago
A gas stream contains 18.0 mole% hexane and the remainder nitrogen. The stream flows to a condenser, where its temperature is re
Anna [14]

Answer:

A. 72.34mol/min

B. 76.0%

Explanation:

A.

We start by converting to molar flow rate. Using density and molecular weight of hexane

= 1.59L/min x 0.659g/cm³ x 1000cm³/L x 1/86.17

= 988.5/86.17

= 11.47mol/min

n1 = n2+n3

n1 = n2 + 11.47mol/min

We have a balance on hexane

n1y1C6H14 = n2y2C6H14 + n3y3C6H14

n1(0.18) = n2(0.05) + 11.47(1.00)

To get n2

(n2+11.47mol/min)0.18 = n2(0.05) + 11.47mol/min(1.00)

0.18n2 + 2.0646 = 0.05n2 + 11.47mol/min

0.18n2-0.05n2 = 11.47-2.0646

= 0.13n2 = 9.4054

n2 = 9.4054/0.13

n2 = 72.34 mol/min

This value is the flow rate of gas that is leaving the system.

B.

n1 = n2 + 11.47mol/min

72.34mol/min + 11.47mol/min

= 83.81 mol/min

Amount of hexane entering condenser

0.18(83.81)

= 15.1 mol/min

Then the percentage condensed =

11.47/15.1

= 7.59

~7.6

7.6x100

= 76.0%

Therefore the answers are a.) 72.34mol/min b.) 76.0%

Please refer to the attachment .

4 0
3 years ago
Design roller chain drive. Specify the chain size, the sizes and number of teeth in the sprockets, the number of chain pitches,
Rom4ik [11]

Answer:

The total design can be summarized as follows:

AC motor 55 hp, 750 rpm  as a driver

Service factor 1.0

Design power 5 hp

No. 40 chain, 0.50 in pitch, 1 strands

17 teeth, 2.72 in pitch dia, 1 strand small sprocket

39 teeth, 7.46 in pitch dia, 1 strand large sprocket

1 strand of length 54 in

Center distance of 19.9 in

Actual Output speed of 326.9 rpm

Type B lubrication

Explanation:

4 0
3 years ago
List two important things to remember when using an ammeter.
Radda [10]

Answer:

Ammeters must always be connected in series with the circuit under test. Always start with the highest range of an ammeter. Deenergize and discharge the circuit completely before you connect or disconnect the ammeter. In dc ammeters, observe the proper circuit polarity to prevent the meter from being damaged.

Explanation:

3 0
3 years ago
Danny enjoys studying transportation networks and systems. Which field of engineering should he pursue?
andre [41]

Answer:

Civil Engineering.

Explanation:

Civil Engineering is a field of engineering study that deals with professional practising in designing and developing infrastructures such as transport system and networks, buildings, etc.

<u>Civil engineering is regarded as the second--oldest form of engineering studies in the field of engineering.</u>

<u>A person who studies civil engineering is able to design and develop major projects in transportations system such as road construction, bridges, airports, tunnels, etc.</u>

So, Danny, who is interested in studying transporation networks and system should opt for studying civil engineering.

8 0
3 years ago
Other questions:
  • All of the following statements are true EXCEPT: A) air should be let out of a tire when it is hot. B) each change in outside te
    11·1 answer
  • Which option supports the following scenario?
    14·1 answer
  • Poached eggs are cooked in bath of boiling water at 100°C. Over time they reach thermal equilibrium with the bath. They are then
    12·1 answer
  • Which of the following are true about algorithms? (You may select more than one)
    10·2 answers
  • You are asked to design a software package for an On-line Banking System (OBS). The OBS will take requests from its user on the
    14·1 answer
  • Madison how do you do this
    10·2 answers
  • 30 points and brainiest if correct please help A, B, C, D
    15·1 answer
  • Sylvie has a robot that helps her wash dishes. Which of the following must be true?
    5·1 answer
  • The marginal rate of substitution is the slope of the indifference curve.
    6·1 answer
  • Which of the following best describes maintenance?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!