Message Boards Message Boards

0
|
4448 Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Approach to a value

Posted 10 years ago
Hi everybody, I have the follow problem, for example give the list {{100,220},{123,154},{210,202},{129,86}} find in this list  the value more proximate to {186,190},  I don not know how do it, someone know?,this is giving me a lot of trouble, thanks in advance
POSTED BY: Luis Ledesma
4 Replies
Posted 10 years ago
is amazing, as I needed I thank you for helping me with this problem and hopefully keep it up with more people, we are in contact
POSTED BY: Luis Ledesma
Posted 10 years ago
Do you mean you want to find the nearest after deleting all of the points that are to the right of the input point?
nearestLess[p_] :=
Nearest[Select[{{425, 218}, {383, 178}, {529, 431}, {690,
     571}}, #[[1]] < p[[1]] &], p]
nearestLess@{412, 280}
{{383, 178}}
POSTED BY: Michael Hale
Posted 10 years ago
many thanks Michael, the command do it ,but I have problems with the following, if  run the command Nearest[ {{290,230},{250,170},{180,140}},{280,105}] returns {290,230} but I want the value {250,170},ie I want to always return the closest value but less than the first number I enter as an argument of the function, in this case {280,105} the first number is 280 and I want  the closest value but less ie the 250, Is there any way?

With another example I hope to explain,
 Nearest[ {{425,218},{383,178},{529,431},{690,571}},{412,280}] returns {425,218} and I want the closest but less {383,178}, I hope you can help me
POSTED BY: Luis Ledesma
Posted 10 years ago
Nearest[{{100, 220}, {123, 154}, {210, 202}, {129, 86}}, {186, 190}]
POSTED BY: Michael Hale
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract