MathGroup Archive 2011

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

Search the Archive

Re: efficiently testing a list


data = Table[{a[i], b[i]}, {i, 1, 3}];

And @@ (f[#[[1]]] < #[[2]] & /@ data)

f[a[1]] < b[1] && f[a[2]] < b[2] && f[a[3]] < b[3]


Bob Hanlon


On Sun, Oct 30, 2011 at 5:25 AM, 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].
>



  • Prev by Date: plotting cdf of a piece-wise continuous distribution
  • Next by Date: Putting Points and Lines into RegionPlot3D
  • Previous by thread: efficiently testing a list
  • Next by thread: Re: efficiently testing a list