Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Re: Element test

  • To: mathgroup at
  • Subject: [mg61393] Re: [mg61217] Re: Element test
  • From: leigh pascoe <leigh at>
  • Date: Tue, 18 Oct 2005 02:44:34 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Jens-Peer Kuska wrote:

>what may MemberQ[] do ??
>Element[] is for infinite/uncountable quantities.
>  Jens
>"leigh pascoe" <leigh at> schrieb im 
>Newsbeitrag news:dii8pd$9cq$1 at
>| Dear Group,
>| I have a defined a graph that is a function of 
>n, gr1[n], with n^2 +4
>| vertices and 2n(n+1) edges.
>| I would like to remove some edges from this 
>graph, corresponding to all
>| edges leading to the vertices in the set 
>list[n]. Since Ma doesn't seem
>| to have a PERL like Foreach construct, I tried 
>something like the following:
>| In[42]:=
>| Do[If[Element[i,list[6]],
>|    ShowGraph[test=DeleteEdges[gr1[6],{{{i,j}} 
>,{ j,1,40}}],
>|      VertexNumber\[Rule]True]],{i,1,40}]
>| Unfortunately this doesn't work. The problem 
>(apart from possible syntax
>| errors) seems to lie in the fact that
>| Element[i, list[6]] never evaluates to True. For 
>a specific example
>| using the list {4,2,9,39,40},
>| In[33]:=
>| Element[39,list[6]]
>| Out[33]=
>| 39\[Element]{4,2,9,39,40}
>| whereas the similar statement
>| In[27]:=
>| 149\[Element]Primes
>| Out[27]=
>| True
>| How can I delete the edges to the vertices in 
>list[n] from my graph?
>| Thanks
>| LP
Thank you Jens and Joerg,

I was misled by the usual notation in set theory of epsilon denoting 
whether x is an element of a set. I am surprised that this does not work 
for a finite set. However MemberQ does what I want and I am now looking 
in the correct section of the Help documentation.


  • Prev by Date: Speeding up Vector Comparison
  • Next by Date: Re: SameTest in Union
  • Previous by thread: Re: Element test
  • Next by thread: Re: SingularValueDecomposition bug: fifty examples