I have an array of 4 coordinates in each array
x0 = [1,2,3,4] #x_coordinates
y0 = [1,2,3,4] #y_coordinates
x1 = [11,12,13,14] #x_coordinates
y1 = [11,12,13,14] #y_coordinates
I would like to find the distance between the two coordinates.
distance = sqrt((x1 - x0)^2 + (y1 - y0)^2)
So, I tried
distance = math.sqrt((x1 - x0)**2 + (y1 - y0)**2)
But the error is TypeError: only length-1 arrays can be converted to Python scalars.
Isnt it possible to do an element wise operation by just using the array_variable? Or do I have to iterate it by using a for loop?
I found this as a probable answer, but looks quite complicated with numpy. calculating distance between two numpy arrays
EDIT:
Tried the following
x_dist = pow((x1 - x0), 2)
y_dist = pow((y1 - y0), 2)
dist = x_dist+y_dist
dist=dist**2
numpyarrays.