MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Nested List Abs[]

  • To: mathgroup at
  • Subject: [mg121039] Re: Nested List Abs[]
  • From: Bob Hanlon <hanlonr at>
  • Date: Wed, 24 Aug 2011 07:50:05 -0400 (EDT)
  • Delivered-to:
  • Reply-to: hanlonr at

data = RandomReal[{0, 2}, {100, 2}];

data2 = Select[data, Abs[#[[1]] - #[[2]]] < 1 &];

data3 = Select[data, Abs[Subtract @@ #] < 1 &];

data2 == data3




Bob Hanlon

---- Sam Korn <sam at> wrote: 

I have a list, and each element of the
list is a sublist with two integers. How do I delete from the larger
list any integer pair whose numerical distance apart is greater than
one? I'd been trying to map Abs[Subtract[#1,#2]]&<1 over the list, but
so far that hasn't worked.

Any suggestions?

Sent from my iPhone

  • Prev by Date: Re: Simplifying certain trigonometric expressions
  • Next by Date: Re: decoding inbuilt function
  • Previous by thread: Re: Nested List Abs[]
  • Next by thread: Re: Nested List Abs[]