-2

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.

  • Do you mean sum of squared differences? Sum of distance between pairs of points? It's definitely not a standard deviation, that's for sure. –  Jan 12 '22 at 00:49
  • Yeah, it could be something like that @enke – akakakakakkaa Jan 12 '22 at 00:51
  • The point is, that we have a theoretical dataset there is exact, and an experimental dataset, and want to compare them – akakakakakkaa Jan 12 '22 at 01:02
  • @j1-lee Yeah, that is of course not a coincidence, we are working together, and he told me that answer, however, I was thinking that there must be something to tell the difference between multiple numbers. But probably sorry for asking a stupid question... – akakakakakkaa Jan 12 '22 at 01:10

1 Answers1

0

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)])
BrokenBenchmark
  • 18,126
  • 7
  • 21
  • 33