On Feb 2, 8:54 pm, YannLC <[email protected]> wrote:
> Why don't you use something like this e.g.:
>
> sage: A.<a,b,c,d,e> = AbelianGroup(5,[4, 5, 5, 7, 8])
> sage: b1 = a^3*b*c*d^2*e^5
> sage: b2 = a^2*b*c^2*d^3*e^3
> sage: b3 = a^7*b^3*c^5*d^4*e^4
> sage: b4 = a^3*b^2*c^2*d^3*e^5
> sage: b5 = a^2*b^4*c^2*d^4*e^5
> sage:  word_problem([b1,b2,b3,b4,b5],e) #random order
> [[a^3*b*c*d^2*e^5, 1], [a^2*b*c^2*d^3*e^3, 1], [a^3*b^3*d^4*e^4, 3],
> [a^2*b^4*c^2*d^4*e^5, 1]]
> sage: ans_dict = {a^3*b*c*d^2*e^5: 1, a^2*b*c^2*d^3*e^3: 1,
> a^3*b^3*d^4*e^4: 3, a^2*b^4*c^2*d^4*e^5: 1}
> sage: dict( word_problem([b1,b2,b3,b4,b5],e) ) == ans_dict  # we use
> dict to avoid ordering problems
> True
>

As always, a better working solution only comes after at least one
working solution has been already presented :-)

Yes, indeed, it makes perfect sense to use dictionaries here.

Unfortunately for irreducible characters (see  groups/
class_function.py patch)
reduce seems to be the only way so far :-(


> (remark: It would make sense for the function word_problem to return a
> dict. This would allow:
> sage: w = word_problem([b1,b2,b3,b4,b5],e)
> sage: w[b3]
> 3
> end of the remark)
>
yes, this is a good idea.

> On Feb 2, 1:07 pm, Dima Pasechnik <[email protected]> wrote:
>
>
>
> > well, I just test what is in EXAMPLES in TESTS (as string comparison
> > fails here, I have to write a bit of code to test properly)
> > It's a bit ugly, but it's a limitation of docstinsg that is impossible
> > to overcome.
>
> > (Please seehttp://trac.sagemath.org/sage_trac/ticket/8150forthe
> > corresponding patch)
>
> > Dmitrii

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to