Given two lists A={a1,a2,a3,...an}
and B={b1,b2,b3,...bn}
, I would say A>=B
if and only if all ai>=bi
.
There is a built-in logical comparison of two lists, A==B
, but no A>B
.
Do we need to compare each element like this
And@@Table[A[[i]]>=B[[i]],{i,n}]
Any better tricks to do this?
EDIT: Great thanks for all of you.
Here's a further question:
How to find the Maximum list (if exist) among N lists?
Method 1: I prefer this method.
Method 2: This is just for fun. As Leonid noted, it is given a bit of an unfair advantage for the data I used. If one makes pairwise comparisons, and return False and Break when appropriate, then a loop may be more efficient (although I generally shun loops in mma):
Some timing comparisons on lists of 10^6 numbers:
Edit: I removed the timings for my Method #2, as they can be misleading. And Method #1 is more suitable as a general approach.