On 16 fév, 15:47, Eviatar <eviatarb...@gmail.com> wrote: > Hello! > > I'm wondering why you would want to include it like this; it doesn't > follow Python syntax. "=" is for assignment, and this: "u * v = phi(u > * v)" would return a syntax error in Python. I suppose you mean "=="?
This would be a new syntax between single quotes. Here is sample of what I would like Solving a simple system:: sage: WS = WordsSystem() sage: WS.add_operator('~', 'a->a,b->b', antimorphism=True) sage: WS.add_equation('u = ~(u)') The generic solution:: sage: list(WS.generic_solutions_iter(max_length=3)) [{'u': [1]}, {'u': '11'}, {'u': '111'}, {'u': '121'}] sage: list(WS.generic_solutions_iter(max_length=3, variables='u')) ['1', '11', '111', '121'] The solution for the given alphabet:: sage: WS.set_alphabet('ab') sage: list(WS.solutions_iter(max_length=3)) [{'u': 'a'}, {'u': 'b'}, {'u': 'aa'}, {'u': 'bb'}, {'u': 'aaa'}, {'u': 'aba'}, {'u': 'bab'}, {'u': 'bbb'}] sage: list(WS.solutions_iter(max_length=3, variables='u')) ['a', 'b', 'aa', 'bb', 'aaa', 'aba', 'bab', 'bbb'] > In that case I would think specialized functions would be better, such > as palindromes(u). For parsing, could you not use regular expressions? I guess regular expressions would be ok, but more work is needed. Ideally, I would like to delegate that work to a module that does all the job! -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org