We have these arrays in python:
a1 = [0, 1, 2, 3]
a2 = [0, 1.1, 2.2, 3.1]
and want to find the deviation between a1 and a2. And sorry, we do not know what's such a type of deviation is named, but probably some of you do know.
We have these arrays in python:
a1 = [0, 1, 2, 3]
a2 = [0, 1.1, 2.2, 3.1]
and want to find the deviation between a1 and a2. And sorry, we do not know what's such a type of deviation is named, but probably some of you do know.
You can find the sum of squared distances (as clarified in the comments) by using sum()
and zip()
:
distance = sum([(elem1 - elem2)**2 for elem1, elem2 in zip(a1, a2)])