Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: efficiently testing a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122534] Re: efficiently testing a list
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Mon, 31 Oct 2011 06:51:18 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110300925.EAA15453@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

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 at 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 at yahoo.com



  • Prev by Date: Re: Simple question about inverse of a function
  • Next by Date: Re: delay evaluation inside RecurrencTable?
  • Previous by thread: Re: efficiently testing a list
  • Next by thread: Re: efficiently testing a list