Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4556
| From | Dana DeLouis <dana01@me.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Nested List Abs[] |
| Date | 2011-08-25 11:06 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j35ace$oct$1@smc.vnet.net> (permalink) |
> How do I delete from the larger list any integer pair
> whose numerical distance apart is greater than one?
Here`s just another of many options:
m=RandomInteger[{-2,2},{10,2}]
{{-1,2},{1,-2},{2,2},{1,-1},{-1,-2},{-2,-2},{2,1},{-2,-1},{1,-2},{2,0}}
Select[m,EuclideanDistance@@#<=1 &]
{{2,2},{-1,-2},{-2,-2},{2,1},{-2,-1}}
Note: These were removed from the list:
Complement[m,%]
{{-1,2},{1,-2},{1,-1},{2,0}}
= = = = = = = = = = =
HTH :>)
Dana DeLouis
$Version
8.0 for Mac OS X x86 (64-bit) (November 6, 2010)
On Aug 24, 3:18 am, Sam Korn <s...@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[] Dana DeLouis <dana01@me.com> - 2011-08-25 11:06 +0000
csiph-web