1
$\begingroup$

Consider the following list of points (x,y):

list = {{1,1}, {2,2}, {3,3}, {2.1,2}, {2.001,2}, {1.001,1.001}, {1.1,1.001} };

How can it be efficiently reduced to:

newList = {{1,1}, {2,2}, {3,3}, {2.1,2}, {1.1,1.001}};

i.e, given a criterion (that can be either the metric distance or rounded number), how can I remove elements from the above list?

$\endgroup$
3
  • $\begingroup$ Have you seen DeleteDuplicatesBy? $\endgroup$
    – C. E.
    Feb 19, 2018 at 18:40
  • $\begingroup$ Union[list, SameTest -> (Norm@#1 - Norm@#2 < 10^-2 &)] $\endgroup$
    – corey979
    Feb 19, 2018 at 18:44
  • $\begingroup$ This answer is wrong, it removes all duplicates but does not reduce it to 1. If u consider my example u get: newList = {{3,3},{2.1,2}}; $\endgroup$
    – jarhead
    Feb 19, 2018 at 18:56

0

Browse other questions tagged or ask your own question.