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


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

Re: efficiently testing a list

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: efficiently testing a list
Date 2011-10-31 11:56 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j8m2ci$ru9$1@smc.vnet.net> (permalink)
References <201110300925.EAA15453@smc.vnet.net>

Show all headers | View raw


list = RandomInteger[10, {20, 2}]

{{2, 2}, {1, 8}, {1, 1}, {4, 7}, {7, 6}, {7, 8}, {7, 2}, {2, 2}, {6,
   6}, {3, 7}, {7, 5}, {4, 8}, {9, 2}, {6, 0}, {0, 8}, {9, 2}, {1,
   0}, {10, 3}, {9, 1}, {9, 9}}

This shows which elements pass the test:

Less @@@ list

{False, True, False, True, False, True, False, False, False, True, \
False, True, False, False, True, False, False, False, False, False}

And this shows whether ALL elements pass the test:

And @@ Less @@@ list

False

Bobby

On Sun, 30 Oct 2011 04:25:09 -0500, zb <zaeem.burq@gmail.com> wrote:

> Consider the list of pairs:
>
> List = Table[ {a[i],b[i]} , {i,1,N} ].
>
> or
>
> List = { {a[1],b[1]} , {a[2],b[2]} , {a[3],b[3]} , ... ,
> {a[N],b[N]} },
>
> and a given function f[a].
>
> What is the quickest way of testing if all elements of List satisfy
> f[a[i]] < b[i].
>
>


-- 
DrMajorBob@yahoo.com

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


Thread

Re: efficiently testing a list DrMajorBob <btreat1@austin.rr.com> - 2011-10-31 11:56 +0000

csiph-web