Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4547
| From | Bob Hanlon <hanlonr@cox.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Nested List Abs[] |
| Date | 2011-08-24 11:50 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j32oir$ds5$1@smc.vnet.net> (permalink) |
data = RandomReal[{0, 2}, {100, 2}];
data2 = Select[data, Abs[#[[1]] - #[[2]]] < 1 &];
data3 = Select[data, Abs[Subtract @@ #] < 1 &];
data2 == data3
True
Length[data2]
71
Bob Hanlon
---- Sam Korn <sam@kornfamily.com> 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
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Nested List Abs[] Bob Hanlon <hanlonr@cox.net> - 2011-08-24 11:50 +0000
csiph-web