Thanks for the bug report. I think you are right that the keyword arguments are being ignored, so I opened trac ticket #34810 <https://trac.sagemath.org/ticket/34810>. Further discussion should be posted there.
However, your second problem is not a bug. The initial state needs to be a state, not a string, so it should work if you change ''q1" to DFA.state("q1") in the final line. Perhaps we should clarify the documentation (or allow the parameter to be a string). On Thursday, November 24, 2022 at 1:41:45 PM UTC-7 lucca....@gmail.com wrote: > I can also trigger an exception with a different automaton defintion: > stateTransitions = {'q0':[('q1', '0')],'q1':[('q1', '1')]} > DFA = Automaton(stateTransitions) > DFA.state('q1').is_final=True > list(DFA.process(['1'],initial_state='q1')) > > [image: a.png] > It's slightly hard to read, but the automaton has two states, q0 and q1, > where q1 is the accepting state. > The transitions are: > q0 -> q1 : 0 > q1 -> q1 : 1 > > The second transition is not in the graph above. > > When running the above code, the following trace is thrown: > AttributeError: 'str' object has no attribute '_in_epsilon_cycle_' > > The datatype doesn't seem to make a difference, wether it's str or not. > Lucca Jimenez-Könings schrieb am Mittwoch, 23. November 2022 um 16:59:57 > UTC+1: > >> import itertools >> stateTransitions = [ >> ('q0', 'q1', '0'), >> ('q1', 'q1', '0'), >> ('q1', 'q2', '1'), >> ('q2', 'q3', '0'), >> >> ] >> DFA = Automaton(stateTransitions, initial_states=['q0'], >> final_states=['q3']) >> list(islice(DFA.language(initial_states=['q1']), None, 10)) >> >> >> I am trying to determine outputs for an automaton from each of its >> states. For that I want to use >> <https://doc.sagemath.org/html/en/reference/combinat/sage/combinat/finite_state_machine.html#sage.combinat.finite_state_machine.Automaton.language>its >> >> language method(link) >> <https://doc.sagemath.org/html/en/reference/combinat/sage/combinat/finite_state_machine.html#sage.combinat.finite_state_machine.Automaton.language>, >> >> as it returns all words that are accepted by the automaton. >> >> The documentation states that: >> >> >> >> *kwargs – will be passed on to the process iterator >> <https://doc.sagemath.org/html/en/reference/combinat/sage/combinat/finite_state_machine.html#sage.combinat.finite_state_machine.FSMProcessIterator>. >> >> See process() >> <https://doc.sagemath.org/html/en/reference/combinat/sage/combinat/finite_state_machine.html#sage.combinat.finite_state_machine.Automaton.process> >> >> for a description. process() * takes, among others, an *initial_state *as >> one of its named arguments. Again, in it's documentation(link) >> <https://doc.sagemath.org/html/en/reference/combinat/sage/combinat/finite_state_machine.html#sage.combinat.finite_state_machine.Automaton.process> >> : >> >> >> - >> >> initial_state or initial_states – the initial state(s) in which the >> machine starts. Either specify a single one with initial_state or a list >> of >> them with initial_states. If both are given, initial_state will be >> appended >> to initial_states. If neither is specified, the initial states of the >> finite state machine are taken. >> >> >> >> So if I understand correctly, by passing initial_state='q1' to the >> DFA.language() method, like in the code above, the automaton should >> output words, beginning from state 'q1', ignoring the previously set >> initial state 'q0' from its initializer. >> >> This doesn't work however. The above code will always yield output >> beginning at 'q0'. >> I did a bit of investigation and I think the reason for this is, that >> **kwargs >> from Automaton.language() is not passed correctly to the >> FSMProcessIterator, as it's mentioned in the docs. I am not good enough >> with the sage codebase or python to debug this however. >> >> Did I do something wrong? If not, it'd be very kind if someone could >> confirm the issue. >> > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/da21f0cd-37c1-4c24-abbb-01012c41f71bn%40googlegroups.com.