Answer:
The functions in Python is as follows:
from math import *
def CalculateTravelSpeed(startX,startY,endX,endY,travelTime):
travelSpeed = EuclideanDist(startX, startY, endX, endY) / travelTime
return travelSpeed
def EuclideanDist(startX, startY, endX, endY):
dist = sqrt((startX - endX)**2 + (startY - endY)**2)
return dist
Step-by-step explanation:
from math import *
This defines the CalculateTravelSpeed function
def CalculateTravelSpeed(startX,startY,endX,endY,travelTime):
This calls the EuclideanDist function to calculate the distance; Next, the speed is calculated
travelSpeed = EuclideanDist(startX, startY, endX, endY) / travelTime
This returns the calculated speed
return travelSpeed
This defines the EuclideanDist function
def EuclideanDist(startX, startY, endX, endY):
This calculates the distance from the given coordinates
dist = sqrt((startX - endX)**2 + (startY - endY)**2)
This returns the calculated distance
return dist