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


Groups > comp.soft-sys.math.mathematica > #7977 > unrolled thread

Re: Is there any efficient easy way to compare two lists with the same length with Mathematica?

Started byAlexei Boulbitch <Alexei.Boulbitch@iee.lu>
First post2012-01-18 11:06 +0000
Last post2012-01-18 11:06 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Is there any efficient easy way to compare two lists with the same length with Mathematica? Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2012-01-18 11:06 +0000

#7977 — Re: Is there any efficient easy way to compare two lists with the same length with Mathematica?

FromAlexei Boulbitch <Alexei.Boulbitch@iee.lu>
Date2012-01-18 11:06 +0000
SubjectRe: Is there any efficient easy way to compare two lists with the same length with Mathematica?
Message-ID<jf6935$gcj$1@smc.vnet.net>
What about this?



B = Range[1000000];

A = Range[1000001, 2000000];

Positive[A - B] /. List -> And // Timing



{0.281, True}



A = Range[1000000];

B = Range[1000001, 2000000];

Positive[A - B] /. List -> And // Timing



{0.281, False}











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?





Alexei BOULBITCH, Dr., habil.

IEE S.A.

ZAE Weiergewan,

11, rue Edmond Reuter,

L-5326 Contern, LUXEMBOURG



Office phone :  +352-2454-2566

Office fax:       +352-2454-3566

mobile phone:  +49 151 52 40 66 44



e-mail: alexei.boulbitch@iee.lu<mailto:alexei.boulbitch@iee.lu>





[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web