SOLUTION: I'm sorry if this is not the right category but I'm not sure where to put this. I need to use this for an AI I'm currently programming and I can't find the right algoritm for this

Algebra.Com
Question 880765: I'm sorry if this is not the right category but I'm not sure where to put this.
I need to use this for an AI I'm currently programming and I can't find the right algoritm for this.
The situation:
I got a collection of points in a coordinate system.
The size of the collection is unknown , but usually between 1 and 20.
The location of the points is completely random.
The desired outcome:
place a new point X so that as many points of the collection as possible are in a given radius of X
I'd like to give some images to explain it further but I don't know how on this website.
I hope I was clear and I'd be really happy if someone could help me.


Answer by rothauserc(4718)   (Show Source): You can put this solution on YOUR website!
If your coordinate system is the Cartesian coordinate system, then you can calculate the euclidean distance from X to each point(p), namely
d = square root ((x1 -px1)^2 + (y1 -py1)^2) where X = (x1, y1) and any point in the set of 20 elements is (px1, py1)
first sort the points on their x coordinates, then subtract the highest x value from the lowest x value and divide by 2, this gives you the x1 value, do the same for the y values so you get the y1 value
estimate the radius by adding x1 and y1 and divide by 2
then check that the distance is < or = the estimated radius for each point
accept if it is and reject if it is not

RELATED QUESTIONS

I'm not sure if this ones the right category... Anyway, for this problem I need to... (answered by MathLover1,ikleyn)
I think this is the right topic but I'm not sure sorry if its not.. Use 3.14 for Pi.... (answered by solver91311)
I'm not sure if this is the section I go to for this question but I have M=3/2, (6, -5)... (answered by jim_thompson5910)
I'm not sure if this is the right category but here it is: Simplify all square roots and (answered by ikleyn)
I'm also not sure if this is the right category for this problem.. SIMPLIFY ALL SQUARE... (answered by ikleyn)
I hope this is the right category. I wasn't sure where to put it. The beginning intro to... (answered by scott8148)
I am having trouble with this question…Use the arithmetic series of numbering of... (answered by venugopalramana)
i am not sure what category to put this under, but what is the derivative of 10x -... (answered by KMST)
Hi, I am trying to solve a problem-- I have to write a paragraph proof for If m<1=m<2,... (answered by midwood_trail)