Re: Intersection over an index
- To: mathgroup at smc.vnet.net
- Subject: [mg128425] Re: Intersection over an index
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 18 Oct 2012 02:37:47 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
On 10/16/12 at 8:12 PM, geoffrey.eisenbarth at gmail.com (Geoffrey Eisenbarth) wrote: >Given a set of n many matrices A[k], I'd like to find any common >eigenvectors. Using >Intersection[Table[Eigenvalues[A[k]],{k,1,n}] doesn't seem to work. >For instance: >A[1] = {{-1, -3, 1}, {0, -3, 0}, {-1, -1, -1}}; A[2] = {{-2, -1, 1}, >{0, -1, 0}, {-1, 1, -2}}; Intersection[Table[A[p], {p, 1, 2}]] >gives me {{{-2, -1, 1}, {0, -1, 0}, {-1, 1, -2}}, {{-1, -3, 1}, {0, >-3, 0}, {-1, -1, -1}}} >Any suggestions? The problem with your approach is Intersection wants two or more lists and you are supplying only one list. I would do what you want as follows: In[1]:= a = {{-1, -3, 1}, {0, -3, 0}, {-1, -1, -1}}; b = {{-2, -1, 1}, {0, -1, 0}, {-1, 1, -2}}; In[3]:= Intersection @@ (Eigenvectors /@ {a, b}) Out[3]= {{-I, 0, 1}, {I, 0, 1}} But if you favor defining a function as you did above to return matrices and want to use Table, then the same result can be obtained with: In[4]:= x[1] = a; x[2] = b; Intersection @@ Table[Eigenvectors[x@n], {n, 2}] Out[5]= {{-I, 0, 1}, {I, 0, 1}}