How to determine if two points with n dimensions each are less than or greater than one another

55 Views Asked by At

I am writing a program that needs to compute if a point with an arbitrary amount of dimensions is less than or greater than another point with an arbitrary amount of dimensions.

It is easy to compute if the amount of dimensions is different: if p1 has more dimensions than p2, then p1 is naturally greater than p2. If p1 has less dimensions than p2, then p1 is naturally less than p2.

But if p1 has the same amount of dimensions as p2, what is the logic used to compare the two? Does every corresponding dimension of p1 have to be less p2 for the overall point of p1 to be less than p2?

Take an example: Suppose that p1 and p2 have seven dimensions each. The values for p1 and p2 are as follows:

p1 = (1, 6, 85, 3, 65, 39, 4)

p2 = (1, 6, 100, 4, 64, 40, 77)

Is p1 less than or greater than p2? If such a conclusion exists, how do you arrive at that conclusion?