The "in" operator is the "\in" function in gap:

sage: G = libgap.SymmetricGroup(3)
sage: g = libgap.eval("(1,2,3)")
sage: isContainedIn = libgap.function_factory(r'\in')
sage: isContainedIn(g, G)
true



On Wednesday, March 30, 2016 at 11:39:14 AM UTC+2, Pierre wrote:
>
> Hi !
>
> I've been playing with libgap, which is great (I love the fact that lists 
> returned by GAP now start at 0...)
>
> I have been unable, however, to elegantly work around the following simple 
> taks. Suppose:
>
> sage: G= libgap.SymmetricGroup(3)
> sage: g= libgap.eval("(1,2,3)")
> sage: g in G # error
>
> This does not work, to test membership. Unsatisfactory workarounds are:
>
> (1) g in G.AsList()
>
> works, but for large G this is VERY inefficient ! GAP is of course clever 
> at testing membership.
>
> (2) use libgap.eval("G:= SymmetricGroup(3)") then libgap.eval("g:= 
> (1,2,3)") then libgap.eval("g in G")
>
> This works, but well, in my real life example G and g are just not built 
> like that.
>
> (3) best so far is
>
> libgap.set_golobal("G", G)
> libgap.set_global("g", g)
> libgap.eval("g in G")
> libgap.unset_global("G")
> libgap.unset_global("g)
>
> works, but is a bit long !
>
> Is there a better way? in particular, is it possible to find the name 
> which G and g must have as variables within GAP? this used to be G.name() 
> with the old GAP interface. Maybe it doesn't make sense anymore.
>
> I guess I could write a little GAP_membership(G, g) function, implememting 
> solution (3). It would work in general (eg, verifying whether g is in a 
> given conjugacy class, as returned by G.ConjugacyClasses() ).
>
> thanks!
> Pierre
>
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to