Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Numpy drones We are going to start with the same array we did way up above: But this time, instead of Uber drivers, think

image text in transcribed

4. Numpy drones We are going to start with the same array we did way up above: But this time, instead of Uber drivers, think of these as positions of Alphabet's Wing delivery drones. Now we would like to find the closest drone to a customer who is at 7,1 . With the previous example we used Manhattan Distance. With drones, we can compute the distance as the crow flies -- or Euclidean Distance. We probably learned how to do this way back in 7 th grade when we learned the Pythagorean Theorem which states: c2=a2+b2 Where c is the hypotenuse and a and b are the two other sides. So, if we want to find c : c=a2+b2 If we want to find the distance between the drone and a customer, x and y in the formula becomes Distxy=(x1y1)2+(x2y2)2 and for wing_1a who is at [4,5] and our customer who is at [7,1] then the formula becomes: Distxy=(x1y1)2+(x2y2)2=(47)2+(51)2=32+42=9+16=25=5 Sweet! And to generalize this distance formula: Distxy=(x1y1)2+(x2y2)2 to n-dimensions: Distxy=i=1n(xiyi)2 Can you write a function euclidean that takes 3 arguments: droneLocation, droneNames, and an array representing one customer's position and returns the name of the closest drone

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 15th International Conference Dasfaa 2010 Tsukuba Japan April 2010 Proceedings Part 1 Lncs 5981

Authors: Hiroyuki Kitagawa ,Yoshiharu Ishikawa ,Wenjie Li ,Chiemi Watanabe

2010th Edition

3642120253, 978-3642120251

More Books

Students also viewed these Databases questions

Question

4. Does cultural aptitude impact ones emotional intelligence?

Answered: 1 week ago