def distance_between_entities(entity1, entity2): """ compute the haversine distance between the two entities An entity is a tuple: (ID, City, State, Latitude, Longitude) :param entity1: :param entity2: :return: the distance (in miles) between the entities """ pass ENTITES LOOK LIKE THIS ID,City,State,Latitude,Longitude A45419E,Plattsburgh,NY,44.704021,-73.471148 A19312D,Aiken,SC,33.554433,-81.69588 A90172S,Tuscaloosa,AL,33.170238,-87.616169 A19394D,Alexandria,VA,38.819853,-77.059645 A27218D,Pittsburgh,PA,40.47441,-79.950968 A68626D,Meadville,PA,41.611599,-80.114891 A17494D,Allentown,PA,40.602658,-75.469236 A86034S,Tonawanda,NY,42.99704,-78.878659 A45142D,Asheville,NC,35.602711,-82.567281 A38298S,Atlanta,GA,33.844371,-84.47405 A14497Y,Roswell,GA,34.055198,-84.370475 A25954D,Austin,TX,30.326374,-97.771258 B46374X,Fairhope,AL,30.480713,-87.861306 B52199S,Cedar Park,TX,30.503949,-97.8242 B83854R,Abingdon,MD,39.472579,-76.277279 B61771D,Blacksburg,VA,37.256283,-80.43473 B84417D,Boerne,TX,29.893137,-98.685719 B71687D,Brevard,NC,35.174351,-82.753971 C77186D,Camden,SC,34.313477,-80.612489 C34069Y,Aldie,VA,38.957718,-77.60375 C27257X,Carrollton,TX,32.962473,-96.89817 C47372X,Columbia,MD,39.206132,-76.887905 H37576E,Cockeysville,MD,39.47931,-76.62996 H51432D,Huntsville,AL,34.718428,-86.556439 A19744F,Albuquerque,NM,35.199592,-106.644831

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter1: Fundamentals Of C++ Programming
Section1.2: Preliminary Two: Exponential And Scientific Notations
Problem 1E: (Practice) Convert the following numbers from exponential form into standard decimal form:...
icon
Related questions
icon
Concept explainers
Question

def distance_between_entities(entity1, entity2):
"""
compute the haversine distance between the two entities
An entity is a tuple: (ID, City, State, Latitude, Longitude)
:param entity1:
:param entity2:
:return: the distance (in miles) between the entities
"""
pass

ENTITES LOOK LIKE THIS
ID,City,State,Latitude,Longitude
A45419E,Plattsburgh,NY,44.704021,-73.471148
A19312D,Aiken,SC,33.554433,-81.69588
A90172S,Tuscaloosa,AL,33.170238,-87.616169
A19394D,Alexandria,VA,38.819853,-77.059645
A27218D,Pittsburgh,PA,40.47441,-79.950968
A68626D,Meadville,PA,41.611599,-80.114891
A17494D,Allentown,PA,40.602658,-75.469236
A86034S,Tonawanda,NY,42.99704,-78.878659
A45142D,Asheville,NC,35.602711,-82.567281
A38298S,Atlanta,GA,33.844371,-84.47405
A14497Y,Roswell,GA,34.055198,-84.370475
A25954D,Austin,TX,30.326374,-97.771258
B46374X,Fairhope,AL,30.480713,-87.861306
B52199S,Cedar Park,TX,30.503949,-97.8242
B83854R,Abingdon,MD,39.472579,-76.277279
B61771D,Blacksburg,VA,37.256283,-80.43473
B84417D,Boerne,TX,29.893137,-98.685719
B71687D,Brevard,NC,35.174351,-82.753971
C77186D,Camden,SC,34.313477,-80.612489
C34069Y,Aldie,VA,38.957718,-77.60375
C27257X,Carrollton,TX,32.962473,-96.89817
C47372X,Columbia,MD,39.206132,-76.887905
H37576E,Cockeysville,MD,39.47931,-76.62996
H51432D,Huntsville,AL,34.718428,-86.556439
A19744F,Albuquerque,NM,35.199592,-106.644831

Haversine a = sin°(Aq/2) + cos 91 · cos 42 · sin²(A/2)
formula:
c = 2· atan2( Va, v(1-a))
d = R·c
Transcribed Image Text:Haversine a = sin°(Aq/2) + cos 91 · cos 42 · sin²(A/2) formula: c = 2· atan2( Va, v(1-a)) d = R·c
def distance between entities(entity1, entity2):
compute the haversine distance between the two entities
An entity is a tuple: (ID, City, State, Latitude, Longitude)
:param entity1:
:param entity2:
:return: the distance (in miles) between the entities
Transcribed Image Text:def distance between entities(entity1, entity2): compute the haversine distance between the two entities An entity is a tuple: (ID, City, State, Latitude, Longitude) :param entity1: :param entity2: :return: the distance (in miles) between the entities
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr