sage recursive functions programming
Hi everyone, can anybody please help me with this please? I am still relatively new to sage programming.
I have two states here a and b, and function f to compute binary strings.
If f is at state a, then f(1) = 0, also return to state a, while f(0)=1, but goes to next state b.
b is the identity state, when f is at b, b(0)=0, and stays at state b, while b(1)=1, but goes back to state a.
for example: suppose start from state a, then we have f(100) = a(100) = 0a(00) = 01b(0) = 010 similarly, suppose we start from state b, then we have f(100) = b(100) = 1a(00) = 11b(0) = 110
Therefore, any binary strings can be calculated by the function and output another binary strings.
Can anybody please help me on how to program this in sage please? Thanks a lot.
This is not really a sage specific thing. This is simply implementing a recursive mathematical definition into a python program/function. So, are you asking whether Sage has some library or class which works with states?
This sounds like homework...
Hi, thanks for reply. It is not homework, but part of research program, trying to program automatons, which is self-similar groups. I basically really weak with programming, but need to try to test some group structures.