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


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

Find common elements in a list of sublists

From Cisco Lane <travlorf@yahoo.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Find common elements in a list of sublists
Date 2012-04-03 08:44 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jleda1$gjk$1@smc.vnet.net> (permalink)

Show all headers | View raw


Suppose I have a list of sublists:

d={{1, 19}, {1, 23}, {1, 5, 25}, {1, 17}, {1, 11}, {1, 5}}

How do I find the elements common to all the sublists?

I can do it using intersection:

Intersection[dx[[1]], dx[[2]], dx[[3]], dx[[4]], dx[[5]], dx[[6]]]

which yields, correctly, {1}, but what if the number of sublists in d is variable?

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


Thread

Find common elements in a list of sublists Cisco Lane <travlorf@yahoo.com> - 2012-04-03 08:44 +0000
  Re: Find common elements in a list of sublists Helen Read <readhpr@gmail.com> - 2012-04-04 08:30 +0000
  Re: Find common elements in a list of sublists Murta <rodrigomurtax@gmail.com> - 2012-04-04 08:35 +0000

csiph-web