#14010: Add `__call__` method to FreeGroupElement
--------------------------------+-------------------------------------------
Reporter: ppurka | Owner: joyner
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.7
Component: group theory | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
--------------------------------+-------------------------------------------
Old description:
> Copy-paste from #12339:
>
> I have some comments regarding the set of patches in #12339. I myself can
> not give much technical input, but I have a colleague here who has been
> trying to use this and has come across some inconsistencies.
>
> 1. Is there a reason why a `FreeGroupElement` does not have the
> `__call__` method? A `FreeMonoidElement` does have the `__call__` method.
> This is needed to make the following work
> {{{#!python
> sage: G.<a,b> = FreeGroup()
> sage: a.subs(a=1,b=2) # We would expect the answer to be 1
> a
> }}}
> 2. Related to the implementation of the `__call__` method is the
> following problem. Suppose in order to make `subs()` work, we implement
> the `__call__` method. The current code has to call `a.Tietze()` to get
> the index of the free generator `a` and its exponent. For a more
> complicated expression the output is as follows, and we would have to go
> along and parse the output tuple to find out the exponent by counting. Is
> there any method (maybe in GAP) which outputs just a list of tuples
> `[(generator1, exponent1), (generator2, exponent2),...]`. This is again
> how `FreeMonoid` is implemented.
> {{{
> sage: (a^2 * b^-3).Tietze()
> (1, 1, -2, -2, -2)
> sage: (a^2 * b^-3).some_function() # some function which gives
> (generator, exponent) tuples
> [(a, 2), (b, -3)]
> }}}
> 3. There is also this inconsistency in the output of the following two
> functions. In language, they say the same thing, but they are not
> mathematically equal (according to the current implementation):
> {{{#!python
> sage: G.<a,b> = FreeGroup()
> sage: test = (a).fox_derivative(a)
> sage: f = test.parent()
> sage: g = GroupAlgebra(G, ZZ)
> sage: print f
> Group algebra of Free Group on generators {a, b, c, d, e} over Integer
> Ring
> sage: print g
> Group algebra of group "Free Group on generators {a, b, c, d, e}" over
> base ring Integer Ring
> sage: print f == g
> False
> }}}
>
> ----
>
> Related discussion in [https://groups.google.com/d/topic/sage-combinat-
> devel/f_Und2NDyFE/discussion combinat-devel].
New description:
I have some comments regarding the set of patches in #12339. I myself can
not give much technical input, but I have a colleague here who has been
trying to use this and has come across some inconsistencies.
1. Is there a reason why a `FreeGroupElement` does not have the `__call__`
method? A `FreeMonoidElement` does have the `__call__` method. This is
needed to make the following work
{{{#!python
sage: G.<a,b> = FreeGroup()
sage: a.subs(a=1,b=2) # We would expect the answer to be 1
a
}}}
2. Related to the implementation of the `__call__` method is the following
problem. Suppose in order to make `subs()` work, we implement the
`__call__` method. The current code has to call `a.Tietze()` to get the
index of the free generator `a` and its exponent. For a more complicated
expression the output is as follows, and we would have to go along and
parse the output tuple to find out the exponent by counting. Is there any
method (maybe in GAP) which outputs just a list of tuples `[(generator1,
exponent1), (generator2, exponent2),...]`. This is again how `FreeMonoid`
is implemented.
{{{
sage: (a^2 * b^-3).Tietze()
(1, 1, -2, -2, -2)
sage: (a^2 * b^-3).some_function() # some function which gives (generator,
exponent) tuples
[(a, 2), (b, -3)]
}}}
--
Comment (by vbraun):
Only one issue per ticket please. I've opened #14012 for your other issue.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14010#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.