Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4621

Re: With Nearest

From Heike Gramberg <heike.gramberg@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: With Nearest
Date 2011-08-28 08:05 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j3csrp$5j4$1@smc.vnet.net> (permalink)
References <201108271217.IAA17756@smc.vnet.net>

Show all headers | View raw


You'll need to specify a suitable DistanceFunction, for example

AA = {{1.3, 1.5}, {21.5, 23.6}, {10, 19}};
Nearest[AA, 20, DistanceFunction :> (Norm[#2[[2]] - #1] &)]

Heike.

On 27 Aug 2011, at 14:17, graser wrote:

> Dear Mathematica group,
> I have a simple question for you.
> Let's say there is an array or matrix like
> 
> AA = {{1.3, 1.5}, {21.5, 23.6}, {10, 19}};
> 
> If I want to extract a list whose second element is close to 20, How
> can I do it with Nearest function?
> Or is there any other method possible?
> ( In this case, the answer should be {10, 19} )
> 
> Thanks!
> 
> 

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: With Nearest Heike Gramberg <heike.gramberg@gmail.com> - 2011-08-28 08:05 +0000

csiph-web