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
kenny6666 [7]
3 years ago
5

I am trying to create a line of code to calculate distance between two points. (distance=[tex]\sqrt{ (x2-x1)^2+(y2-y1)^2}) My li

ne is point_dist = math.sqrt((math.pow(x2 - x1), 2) + math.pow(y2 - y1), 2) but I am getting an error saying that pow is expecting two arguments and is only getting one. Can anyone help me?
Engineering
1 answer:
k0ka [10]3 years ago
6 0

Answer:

point_dist = math.sqrt((math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2))

Explanation:

The distance formula is the difference of the x coordinates squared, plus the difference of the y coordinates squared, all square rooted.  For the general case, it appears you simply need to change how you have written the code.

point_dist = math.sqrt((math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2))

Note, by moving the 2 inside of the pow function, you have provided the second argument that it is requesting.

You were close with your initial attempt, you just had a parenthesis after x1 and y1 when you should not have.

Cheers.

You might be interested in
Write a new ARMv8 assembly file called "lab04b.S" which is called by your main function. It should have the following specificat
Len [333]

Answer:

my_mul:

.globl my_mul

my_mul:

   //Multiply X0 and X1

   //   Does not handle negative X1!

   //   Note : This is an in efficient way to multipy!

   SUB SP, SP, 16       //make room for X19 on the stack

   STUR X19, [SP, 0]    //push X19

   ADD X19, X1, XZR     //set X19 equal to X1

   ADD X9 , XZR , XZR //set X9 to 0

mult_loop:

   CBZ X19, mult_eol

   ADD X9, X9, X0

   SUB X19, X19, 1

   B mult_loop

mult_eol:

   LDUR X19, [SP, 0]

   ADD X0, X9, XZR      // Move X9 to X0 to return

   ADD SP, SP, 16       // reset the stack

   BR X30

Explanation:

6 0
3 years ago
500 flights land each day at San Jose’s airport. Assume that each flight has a 5% chance of being late, independently of whether
BARSIC [14]

Answer:

a.0.0199

b.0.1765

c.0.0785

d.0.1268

e.Yes

Explanation:

It is given that   X follows a  Binomial distribution with (n= 500, p = 0.05)

The  probabilities  are computed using the EXCEL .

a) The required probability here is:

P(X less of equal to  15)

= binom.dist(15,500,0.05,TRUE)

=0.0199

Therefore the probability is 0.0199 .

b) The required probability here is:

P(X greater or equal to 30) = 1 - P(X less or equal to  29)  

=1 - binom.dist(29,500,0.05,TRUE)

=0.1765

Therefore the probability is 0.1765

c) P(X = 26 )

= binom.dist(26,500,0.05,FALSE)  

=0.0785

Therefore the probability is 0.0785

d) The required probability here is computed as:

P(10 less or equal to X less or equal to 20 ) = P(X less or equal to 19) - P(X less or equal to 10)

= binom.dist(19,500,0.05,TRUE) - binom.dist(10,500,0.05,TRUE)

=0.1268

Therefore the probability 0.1268

e) Yes . Therefore the probability because that is the assumption used to apply binomial distribution .

6 0
3 years ago
To provide some perspective on the dimensions of atomic defects, consider a metal specimen that has a dislocation density of 105
GenaCL600 [577]

Answer:

62.14\ \text{miles}

6213727.37\ \text{miles}

Explanation:

The distance of the chain would be the product of the dislocation density and the volume of the metal.

Dislocation density = 10^5\ \text{mm}^{-2}

Volume of the metal = 1000\ \text{mm}^3

10^5\times 1000=10^8\ \text{mm}\\ =10^5\ \text{m}

1\ \text{mile}=1609.34\ \text{m}

\dfrac{10^5}{1609.34}=62.14\ \text{miles}

The chain would extend 62.14\ \text{miles}

Dislocation density = 10^{10}\ \text{mm}^{-2}

Volume of the metal = 1000\ \text{mm}^3

10^{10}\times 1000=10^{13}\ \text{mm}\\ =10^{10}\ \text{m}

\dfrac{10^{10}}{1609.34}=6213727.37\ \text{miles}

The chain would extend 6213727.37\ \text{miles}

3 0
3 years ago
Why is it important to cut all the way through an electrical wire on the first try?
lbvjy [14]

Answer:

I always thought it was so that the older wire could not have a problem and have another electrician must come back and fix it.

Explanation:

6 0
3 years ago
What is the magnetic force on a moving electric charge called
crimeas [40]
The magnetic force on a free moving charge is perpendicular to both the velocity of the charge and the magnetic field with direction given by the right hand rule. The force is given by the charge times the vector product of velocity and magnetic field.
4 0
3 years ago
Read 2 more answers
Other questions:
  • Thermal energy generated by the electrical resistance of a 5-mm-diameter and 4-m-long bare cable is dissipated to the surroundin
    12·1 answer
  • This is a new technology meant to reduce vehicle roll-overs A. Lane-departure warning B. Anti-lock brakes C. Inspection reports
    7·1 answer
  • A rectangular concrete beam has dimensions b=16 in. and h=30 in. The location of the Gr. 60 reinforcing bars, which are placed a
    15·1 answer
  • 2. In the above figure, what type of cylinder arrangement is shown in the figure above?
    9·2 answers
  • Write a program that asks the user to enter a list of numbers. The program should take the list of numbers and add only those nu
    7·1 answer
  • A compressor receives air at 290 K, 95 kPa and shaft work of 5.5 kW from a gasoline engine. It should deliver a mass flow rate o
    7·1 answer
  • First real answer i’ll give Brainlyist
    12·1 answer
  • Calculate the tensile modulus of elasticity for a laminated composite consisting of 62 percent by volume of unidirectional carbo
    8·1 answer
  • A protocol is a set of rules or procedures, usually written, that should be followed in specific situations. Which of the follow
    12·1 answer
  • Valorant Or Csgo? which is best in your opinion?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!